Issue while converting Multi Frame TIFF image into PDF document

Hi Wasim,


Could you please confirm the API version that you have used for the said testing?

I used aspose-imaging-2.6.0-jdk16.jar. Please see attached.
I tried in Windows 7 OS this time.

Thanks,
Wasim

Hi Wasim,


I am so sorry that none of the provided solutions helped in your scenario. Unfortunately, I am unable to replicate the problem so I can only suggest workarounds for the time being. Anyway, I have requested the product team to review your case and provide further insight of the problem. As soon as I receive any updates in this regard, I will post here for your kind reference.

In the meanwhile, could you please confirm, are you still experiencing the FrameworkException at Image.load method? If the exception has changed (with latest revision of Aspose.Imaging for Java API) or any other statement is triggering the errors then please provide details.

Yes Babar,

Framework exception is still thrown at Image.Load() method with latest API aspose-imaging-2.6.0-jdk16.jar also.
Any workaround is Ok for now as Client wants this issue fixed immediately. As I had said earlier sometimes my application hangs there for 20-30 mins before throwing exception while calling image.load() method and that is not acceptable and has to be fixed ASAP. So, please help. Unfortunately default Java lib also doesnt have much processing options with multipage TIF frames so resizing the image is also not an option.

Thanks,
Wasim

Hi Wasim,


Please try the following piece of code against latest version of Aspose.Imaging for Java 2.6.0, and feed us back with your results. Please note, we have optimized your original code for memory considerations by saving the TiffFrames directly, rather than loading & saving pixels.

Java

TiffImage multiImage = (TiffImage) Image.load(<>);
int frameCounter = 0;
for (TiffFrame tiffFrame : multiImage.getFrames())
{
JpegOptions jpgCreateOptions = new JpegOptions();
jpgCreateOptions.setResolutionSettings(tiffFrame.getFrameOptions().getResolutionSettings());
tiffFrame.save(<>, jpgCreateOptions);
Pdf pdf1 = new Pdf();
Section sec1 = pdf1.getSections().add();
aspose.pdf.Image img1 = new aspose.pdf.Image(sec1);
sec1.getParagraphs().add(img1);
img1.getImageInfo().setFile(<>);
pdf1.save(<>);
}

Hi Babar,

Yesterday, I tried with the code you provided and this time at least exception was not thrown. However the program takes almost 12-15 minutes in converting the file to PDF ( compared to usual few milliseconds for other formats) and that is not what we are expecting.

Just curious, I thought the issue was in loading the image at the below line, we didnt change this line but the loading of pixel code. How it’s able to load the tiff image now?
TiffImage multiImage = (TiffImage) Image.load(<>);

Thanks,
Wasim

Hi Wasim,


It is good to know that you are able to avoid the said exception while using the recently provided code snippet. Please note, upon further investigation we have noticed that the FrameworkException could have been triggered due to the following statement so we have provided you the alternative approach to achieve the same goal.

Java

Color[] pixels = multiImage.loadPixels(tiffFrame.getBounds());

Regarding your concerns related to the performance of the API, I am afraid, the process to load & split the frames from a sample of such huge dimensions will take some time to complete. We are already working to improve the core component (.NET) for performance considerations, and hope to publish these improvements with the release of Aspose.Imaging v2.9.0.

Hi Wasim,


This is to inform you that we have improved the overall performance of the Aspose.Imaging for Java API with the release of v2.9.0. Further improvements are expected with v3.0.0. In order to evaluate the performance improvements with v2.9.0, please download the release and give it a try on your end while using the code snippet shared here. Please let us know if your feedback.

Please note, as you are using two Aspose APIs to achieve your ultimate goal, therefore we also suggest you to try the scenario with & without using Aspose.Pdf so you could observe the improvements of Aspose.Imaging for Java API. Moreover, the tickets related to Aspose.Pdf for Java API have been logged and attached to this thread so you may follow up there.