0

I am using getRotatedImage function of ImageUtil class of apache pdfbox library to rotate a Buffered Image. The output is perfectly rotated image provided with Buffered image and degree of rotation. The only problem is that the output image when converted to pdf is more than double the size of original image, i.e 1.7MB image is converted to 4.3MB pdf. Is there any problem with ImageUtil.getRotatedImage method of pdfbox library.

The format of image was .tif and i used LosslessFactory.createFromImage(doc, bim) to create PDImageXObject object.

Arbaz Sheikh
  • 217
  • 2
  • 10
  • What was the format of the source image? What method did you use to create the image XObject? – Tilman Hausherr Sep 13 '20 at 17:22
  • The format of image was .tif and i used *LosslessFactory.createFromImage(doc, bim)* to create PDImageXObject object. – Arbaz Sheikh Sep 14 '20 at 04:56
  • Was it a black and white tif? Then you're likely losing the excellent G4 compression and getting Flate compression instead. Try `CCITTFactory`. For rotation, rotate / translate the CTM. See also https://stackoverflow.com/questions/23867451/image-rotation-with-pdfbox – Tilman Hausherr Sep 14 '20 at 12:15
  • Btw, the ImageUtil class is from PDFDebugger. That isn't part of the API, it's just something to help with display. – Tilman Hausherr Sep 14 '20 at 12:17

0 Answers0