Got it about that!
I'm not sure this is the official way, but here's how to do it.
XWPFRun does not give you any information, but XWPFPicture has a method called getCTPicture which will return the XML part of the image to the docx file using your favorite XML parser, all you need to do is find "/ xml-fragment / pic: spPr / a: xfrm / a: ext "(xpath) in the XML structure, this tag will have cx and cy attributes, this is mainly the display width and image height in EMU English metric units. If you are google, you can find EMUS_PER_INCH = 914400 so that you can convert this to inches (or later convert inches to pixels, if I'm not mistaken, it should be 96 pixels per inch) so when calculating you can determine the new width and height of the image.
Complexity, but that's what it is. And it works.
Hope this helps someone.
source share