In HSSFPicture.getPreferredSize(). This line: h += (1 - anchor.dy1/256)* getRowHeightInPixels(anchor.row1); doesn't work right. It computes (1 - anchor.dy1/256) as an integer before applying it as a fraction to getRowHeightInPixels. So you always get h incremented by 1 full row height (anchor.dy/256 evaluates to 0). It works if I change it to: h += ((float)1 - (float)anchor.dy1/256)* getRowHeightInPixels(anchor.row1); Same problem with the code to apply an initial x-offset to the image width: //space in the leftmost cell w += getColumnWidthInPixels(anchor.col1)*(1 - anchor.dx1/1024); should be: w += getColumnWidthInPixels(anchor.col1)*((float)1 - (float)anchor.dx1/1024);
Thanks for the suggestion. Applied in r718023. P.S. Inspired by the "images and anchors - controlling image size" thread in poi-user, I added HSSFPicture.resize(double scale). scale is the amount by which image dimensions are multiplied relative to the original size: picture.resize(); //resets to 100% size picture.resize(1); //resets to 100% size picture.resize(2); //resets to 200% size picture.resize(0.5); //resets to 50% size Yegor