OutOfMemoryError using TiffFrame.rotateFlip()

I am trying to rotate various frames of a multi-paged TIFF file using the TiffFrame.rotateFlip() method (aspose-imaging-1.8-jdk15) and have encountered an OutOfMemoryError.

The rotateFlip() method appears to take about 35 seconds to apply (which is too slow) and if two rotations are called back to back it throws the OutOfMemoryError about 15 seconds into the second rotation. Please advice if there is a different\quicker approach for these rotations.

// Load the 3 multipaged TIFF
TiffImage tiffImage = (TiffImage) Image.load("C:/Temp/TestTIFF.tif");

// Rotate the first page 90 degrees

// Rotate the second page 180 degrees

// Rotate the third page 270 degrees

// Save the TIFF

java.lang.OutOfMemoryError: Java heap space
at com.aspose.imaging.internal.r.g.(Unknown Source)
at com.aspose.imaging.internal.s.b.a(Unknown Source)
at com.aspose.imaging.V.a(Unknown Source)
at com.aspose.imaging.V.a(Unknown Source)
at com.aspose.imaging.internal.s.a.a(Unknown Source)
at com.aspose.imaging.fileformats.tiff.u.a(Unknown Source)
at com.aspose.imaging.fileformats.tiff.TiffFrame.a(Unknown Source)
at com.aspose.imaging.RasterCachedImage.b(Unknown Source)
at com.aspose.imaging.RasterImage.a(Unknown Source)
at com.aspose.imaging.RasterImage.a(Unknown Source)
at com.aspose.imaging.RasterImage.loadPartialPixels(Unknown Source)
at com.aspose.imaging.RasterCachedImage.rotateFlip(Unknown Source)

TestTiff.tif detials:


Thank you for considering Aspose products.

I am afraid; I am unable to observe any of the issues as mentioned in your post. I have executed your exact code on a similar multi-framed Tiff images on Windows 7 Home Premium 64bit edition having 6GB of RAM. No exception was thrown and I could get the desirable results in almost 10 seconds.

In order to further investigate the said issue, I would request you to please provide your sample input file and more details about your environment.

I have attached two sample TIFF files:

  • TestTIFF1000x1000.tif -- works
  • TestTIFF2550x3300.tif -- out of memory

I have experimented with different dimensions, compression, resolutions settings and haven't quite narrowed in on the combination where the out of memory error is thrown. But I have found that a 1000x1000 tiff rotates without the error whereas a 2550x3300 tiff does run out of memory. Also the number of pages doesn't seem to sway the speed of the rotation but the dimensions certainly does.

My environment: Windows 7 Enterprise 64-bit with 4GB of RAM.

Hi Scott,

Thank you for sharing your sample files and more details about the issue.

I am able to reproduce the said exception on my end while using the latest version of Aspose.Imaging for Java component. A ticket has been logged in our bug tracking system to further investigate the problem cause, and to rectify it at earliest. The ticket Id for your future reference is IMAGING-33727. We will keep you posted with updates via this forum thread.

Please accept our apologies for your inconvenience.

The issues you have found earlier (filed as IMAGING-33727) have been fixed in this update.

This message was posted using Notification2Forum from Downloads module by Aspose Notifier.

The issues you have found earlier (filed as ) have been fixed in this Aspose.Words for JasperReports 18.3 update.