Free Support Forum - aspose.com

[Issues] aspose-imaging convert error with large image size or rotate/flip options

convert_issues_attach_files.zip (153.4 KB)
Hi Aspose Support Team,
We use aspose-imaging to convert tiff, png, jpg to tiff, png, jpg format and got a lot of issues:

+ With aspose-imaging:20.4
Because of performance issue when convert to tiff format, we upgrade aspose lib from version 19.7 to 20.4. But we got an issue on UAT environment that still could not reproduce on local yet: Image export failed. —> class com.aspose.imaging.internal.Exceptions.ArgumentOutOfRangeException: The processing area width must be positive and more than 0.
Parameter name: areaToProcess
You can refer to error_log.txt file for details. The issue occur when convert 4 tiff files on 1 request, each file have file size < 1 MB for each. Do not happen when convert 2 tiff file on 1 request. Because of this issue, we must revert aspose-image to version 19.7 now.

And with version 20.4, we got these below issues:

  1. When convert from jpg / png / tiff file with rotate option to jpg / png / tiff, the output result contain multiple stripes on the background. Please refer to Test_jpg.jpg for details.

  2. Could not convert from tiff file - 1 bit-depth to png format with rotate option.

  3. When convert image to PNG format, if we set pngOptions.setProgressive(true), we got Image export failed. —> java.lang.ArrayIndexOutOfBoundsException: 0 exception when convert without rotate/flip.

+ With aspose-imaging:19.7

  1. When convert from jpg / png file with rotate option to jpg / png / tiff, the output result contain multiple stripes on the background. You could refer to Test_jpg.jpg for details. Do not happen with tiff source file.

  2. It take a lots memory when convert large image size (~30MB). It need at least 4GB RAM to convert 1 image, and usually got full hard disk issue - need to restart PC to release hard disk space.

  3. When convert image to PNG format, if we set pngOptions.setProgressive(true), we got Image export failed. —> java.lang.ArrayIndexOutOfBoundsException: 0 exception when convert without rotate/flip - the same as 20.4 version.

We are on UAT phase but got a lot of issues on image converter. Please help to investigate and trouble shoot these above issues.
And with aspose-image:19.7, do you have any work around to remove stripes on the image when convert from png to tiff file? This is the urgent task on our UAT phase.

P/S: I included full demo project for easy troubleshooting. You can switch aspose-image version on pom.xml & run AsposeImageConverterUtilsTest.java to verify result. Please add Aspose.Total.Java.lic to image-converter-demo\src\main\resources for license applying.

Hope to hear from you soon.

Regards,
Thai Tran

@slmspsvietnamvn,

I have observed the issues shared by you and we will consider the issues arising owing to Aspose.Imaging for Java 20.4.

An issue with ID IMAGINGJAVA-1677 has been created to further investigate and resolve this issue.

For these two issues, please share the source TIFF file along with generated output,

Please share the for which file this issue is happening. Please share the portion of code in your demo to verify this too.

@ mudassir.fayyaz

Could not convert from tiff file - 1 bit-depth to png format with rotate option .

You could extract my attached zip file on first post & refer to convert_issues_attach_files.zip\convert_issues_attach_files\image-converter-demo\src\test\resoures\1bit.tiff for source TIFF

You could use my above TIFF file.
In my demo, you could change convert_issues_attach_files.zip\convert_issues_attach_files\image-converter-demo\src\main\java\image\demo\AsposeImageConverterUtils.java, line 80 from pngOptions.setProgressive(false) to pngOptions.setProgressive(true);.
After that on AsposeImageConverterUtilsTest.java, You can change test case convertTifToPngWithDPI to run without rotate/flip to reproduce this issue - at line 110, change from .convertImageToImage(inputStream, “png”, “1bit_tif.png”, 90, “horizontal”); to .convertImageToImage(inputStream, “png”, “1bit_tif.png”, 0, null);

P/S: with version 20.4, a big issue that we could not reproduce on another environment that attached on error_log.txt. Please help to take a look.

Thanks.

@slmspsvietnamvn,

An issue with ID IMAGINGJAVA-1678 has been added to investigate and resolve the issue.

An issue with ID IMAGINGJAVA-1679 has been added to investigate and resolve the issue.

@mudassir.fayyaz
Thank you!

Could you take a look on the error log (attached file) and share with us which cases this error could happen? We used the same code that provided for you on our UAT env and got this issue with aspose-image:20.4 when convert 4 tiff file (1 bitdepth) to png - could not reproduce on local environment. error_log.pdf (52.9 KB)

@slmspsvietnamvn,

I have observed the PDF shared by you and we need to investigate this on our end. In order to proceed further, please provide the source code, environment and Java details and source file reproducing the issue. Please also share local environment details where there is no issue.

@mudassir.fayyaz,

Sorry for late response. I could reproduce this issue now. Please set -Xmx1024M and run below test case with my provided demo on the first post:
@Test
public void convertTifToPng3WithDPI() {
for (int i = 0; i < 10; i++) {
final InputStream inputStream = this.getClass().getResourceAsStream("/1bit.tif");
AsposeImageConverterUtils
.convertImageToImage(inputStream, “png”, “1bit_tif.png”, 0, null);
}
}

And as mentioned on the first post, we got issue when convert large image size. Currently, with version 20.4, we could not convert 30MB JPG image to JPG/PNG/TIF format with rotate option. Please add the image in this link: 30mb.jpg to image-converter-demo\src\test\resoures, run 3 last test cases that I commented out on AsposeImageConverterUtilsTest.java and verify output results (output is only black color image…).

@slmspsvietnamvn,

I have observed your following comments.

You are using a big file and suggesting to use small stack size. Can you please try using atleast try using more stack size like 4GB on your end then share your feedback.

@mudassir.fayyaz

No, in case -Xmx1024M, and run convertTifToPng3WithDPI() test case, the image size is only 20KB (image-converter-demo\src\test\resoures\1bit.tif), not a big file.

In case 30MB file size, with -Xmx8192M, it still cannot convert image 30MB with rotate option.

@slmspsvietnamvn,

Thank you for sharing the information. I have created a ticket with ID IMAGINGJAVA-1689 in our issue tracking system to further investigate and resolve the issue. This thread has been linked with the issue so that you may be notified once the issue will be fixed.

@mudassir.fayyaz,
One more case for you to investigate - with the code that I provided in the demo. Please run below test case with the image that I attached in this post :
@Test
public void convertPNGToPng1BitWithDPI() {
final InputStream inputStream = this.getClass().getResourceAsStream("/00020.png");
AsposeImageConverterUtils
.convertImageToImage(inputStream, “png”, “00020_png.png”, 0, null);
}
00020.png (13.6 KB)

The result is only a black background. It cannot convert 1 bitdepth png file to png format (In case we want to keep file format but change DPI).

Thanks.

@slmspsvietnamvn,

I have observed the issue shared and a ticket with ID IMAGINGJAVA-1692 has been created in our issue tracking system to further investigate and resolve the issue. This thread has been linked with the issue so that you may be notified once the issue will be fixed.

The issues you have found earlier (filed as IMAGINGJAVA-1692,IMAGINGJAVA-1689) have been fixed in this update.