Created attachment 31178 [details] Java Class to resize XSSFPicture with two different scales Because XSSFPicture is a final class, this method calls the XSSFPicture and resize it with different scales. The method getPreferredSize was modified to allow two scales. Both method can be found in the attachment of this bug.
Any chance you could write up a unit test or two for this new functionality?
Sorry, the JUnit tests are from the company and they can't be shared. There is any test framework you use that can be shared so we can generate tests and post it here?
Created attachment 31209 [details] JUnit test of modified resize and getPreferredSize
Just add an attachment that contains a JUnit test of the modified method resize.
Thank you for the patch. I've moved the code to the common model for HSSF/XSSF. The resizing is now based on the anchor, i.e. relative on how the picture was displayed before in the sheet, and not anymore solely on the embedded image dimensions. If one wants to scale relatively to the embedded image, the resize() method without parameters needs to be called before the actual resize() with a parameter. The resizing gave different results with HSSF/XSSF before, so I think it's ok to generalize it now and make it relatively to the anchor. Now the initial position (top left corner) is kept. I haven't changed the side effect of getPreferredSize(), although it actually sets something in the picture instead of just returning a dimension ... Applied with r1638623
*** Bug 57634 has been marked as a duplicate of this bug. ***