com.aspose.imaging.exceptions.imageformats.TiffImageException: Unable to remove current frame

Hi Team,

I am trying to manipulate a tiff image and delete page from the tiff image using the following code:

tiffImage.removeFrame(0);

I am getting following error.

Java Imaging API aspose-imaging-2.1.0.0-jdk16.jar

OS- windows , linux both same error.

We are already in UAT and now we are getting this error. it wil be helpful if you can provide a quick response.2014-10-20 12:26:23,667 ERROR [DocumentTiffTransformation] error occured Unable to remove current frame
2014-10-20 12:26:23,667 ERROR [DocumentTiffTransformation] error occured
com.aspose.imaging.exceptions.imageformats.TiffImageException: Unable to remove current frame
at com.aspose.imaging.fileformats.tiff.TiffImage.removeFrame(Unknown Source)
at com.bac.doc.service.DocumentTiffTransformation.deletePages(DocumentTiffTransformation.java:89)
at com.bac.doc.service.DocumentTiffTransformation.updateTiffDocument(DocumentTiffTransformation.java:51)
at com.bac.doc.service.DocumentManager.updateWipDocument(DocumentManager.java:355)
at com.bac.doc.service.DocumentManagementRepository.updateWipDocument(DocumentManagementRepository.java:89)
at com.bac.doc.controller.DocumentManagementController.updateWipDocument(DocumentManagementController.java:889)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.springframework.web.bind.annotation.support.HandlerMethodInvoker.invokeHandlerMethod(HandlerMethodInvoker.java:176)
at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.invokeHandlerMethod(AnnotationMethodHandlerAdapter.java:436)
at v

Hi Sarika,


Thank you for contacting Aspose support.

The said exception (TiffImageException: Unable to remove current frame) is caused due to the reason that removing the active frame is not allowed by Aspose.Imaging APIs. You can workaround this situation by first setting any other frame as active and then remove the active frame from the collection. Unfortunately, the current implementation of Aspose.Imaging for Java API isn’t offering mechanism to retrieve a specific frame from the Tiff Frame Collection so that it could be set as active frame. We have logged this as a bug in our database under the ticket IMAGING-34422, and we will try our best to provide the fix with the upcoming release v2.4.0 that is scheduled for the 1st quarter of November 2014.

We are sorry for the inconvenience caused to you.

Hi Sarika,


Thank you for your patience with us.

We have further evaluated the case logged earlier as IMAGING-34422. We believe it is the correct behavior of Aspose.Imaging for Java API to throw TiffImageException: “Unable to remove current frame.” when active frame is being removed. As discussed earlier, the correct way to remove an active frame is to first set the active frame to any other frame from the TiffFrameCollection. Please try the following piece of code with Aspose.Imaging for Java 2.1.0, and let us know if you face any difficulty.

Java

TiffImage image = (TiffImage)Image.load(“D:/temp/test+tif+2.tif”);
image.setActiveFrame(image.getFrames()[1]);
image.removeFrame(0);
image.save(“D:/temp/output.tif”);

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