Free Support Forum - aspose.com

Problem loading an image with Aspose.Imaging (Java)

When we try to load the image that I attach, it never ends and the process is blocked in the load
I use the latest version of the library in local (aspose-imaging-21.3-jdk16) and the previus one on the server (aspose-imaging-21.2-jdk16)
I have tested it both on the server and locally, staying in the same place.

Image:
IMG20210329113654.jpg (1.7 MB)

Java Code:


    public static Path loadImage(Path pathOriginal) {
    	logger.info("ImagingService.loadImage()::INICIO -> pathOriginal={}", pathOriginal);
    	long startTime = System.currentTimeMillis();
    	
    	Image image = null;
    	try {
    		final ProgressEventHandler loadHandler = new ProgressEventHandler() {
    			@Override
    			public void invoke(ProgressEventHandlerInfo info) {
    				logger.debug("Load event {} : {}/{}", info.getEventType().toString(), info.getValue(), info.getMaxValue());
    			}
    		};
    		LoadOptions loadOptions = new LoadOptions();
    		loadOptions.setProgressEventHandler(loadHandler);
    		image = Image.load(pathOriginal.toString(), loadOptions); //Never Complete
    		logger.debug(">>Original Size: width={}, heigth={}", image.getWidth(), image.getHeight());
    		
    	} finally {
    		if (image != null) {
    			image.dispose();
    		}
    	}

    	long endTime = System.currentTimeMillis() - startTime;
    	logger.info("ImagingService.loadImage()::FIN ({} ms)", endTime);
    	return pathOriginal;
    }

Logs:
10:44:28.045 [main] INFO test.services.ImagingService - ImagingService.loadImage()::INICIO -> pathOriginal=D:\documentos\images\IMG20210329113654.jpg
10:44:28.156 [main] DEBUG test.services.ImagingService - Load event Initialization : 1/4
10:44:28.552 [main] DEBUG test.services.ImagingService - Load event PreProcessing : 2/4
10:44:28.565 [main] DEBUG test.services.ImagingService - Load event Processing : 3/4

@patriciaRD

I have created a ticket with ID IMAGINGJAVA-7770 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.

@patriciaRD

We have tested this issue with Aspose.Imaging for Java 21.3 and Aspose.Imaging for Java 21.4 and could not reproduce the issue. In these cases everything works as expected and takes about 466 ms.

Can you please give us more information about memory limitation you use for JVM and others specific configuration keys for java? What kind of Java Runtime Environment you uses along with Operating System details.

@mudassir.fayyaz

I have performed the test in different environments:

ENVIRONMENT 1

Windows Server 2012 R2 Datacenter
Intel Xeon CPU E5-2699 v4 2.20GHz (Virtual processors: 8)
RAM 16GB

Java version:

Java™ SE Runtime Environment (build pwa6480sr2fp10ifix-20160223_01(SR2 FP10+IV81318+IV81645+IV81741+IV81716))
IBM J9 VM (build 2.8, JRE 1.8.0 Windows Server 2012 R2 amd64-64 Compressed References 20160210_289934 (JIT enabled, AOT enabled)
J9VM - R28_Java8_SR2_20160210_1617_B289934
JIT - tr.r14.java_20151209_107110.04
GC - R28_Java8_SR2_20160210_1617_B289934_CMPRSS
J9CL - 20160210_289934)
JCL - 20151231_01 based on Oracle jdk8u71-b15

JAVA ARGUMENTS: -Xms256M -Xmx2560M

ENVIRONMENT 2

Windows Server 2012 R2 Datacenter
Intel Xeon CPU E5-2640 v2 2.00GHz (Virtual processors: 4)
RAM 8GB

Test with 2 different java versions:

1. Java™ SE Runtime Environment (build pwa6480sr2fp10ifix-20160223_01(SR2 FP10+IV81318+IV81645+IV81741+IV81716))
IBM J9 VM (build 2.8, JRE 1.8.0 Windows Server 2012 R2 amd64-64 Compressed References 20160210_289934 (JIT enabled, AOT enabled)
J9VM - R28_Java8_SR2_20160210_1617_B289934
JIT - tr.r14.java_20151209_107110.04
GC - R28_Java8_SR2_20160210_1617_B289934_CMPRSS
J9CL - 20160210_289934)
JCL - 20151231_01 based on Oracle jdk8u71-b15

2. java version “1.8.0_202”
Java™ SE Runtime Environment (build 1.8.0_202-b08)
Java HotSpot™ 64-Bit Server VM (build 25.202-b08, mixed mode)

JAVA ARGUMENTS: -Xms256M -Xmx1024M

ENVIRONMENT 3

Windows 10 Pro
Intel Core i5-6300 2.40GHz 2.50GHz
RAM 8GB

Java version

java version “1.8.0_202”
Java™ SE Runtime Environment (build 1.8.0_202-b08)
Java HotSpot™ 64-Bit Server VM (build 25.202-b08, mixed mode)

JAVA ARGUMENTS: -Xms256M -Xmx1024M

In all environments the execution is blocked in the loading of the image.

This blocking also occurs with other different images, I upload an image with which the load is also blocked.

Image_Load_2.jpg (2.5 MB)

Now I have also tried version Aspose.Imaging for Java 21.4 and the same thing happens.

@patriciaRD

Thank you for sharing the feedback with us. We will share the good news with you as soon as the issue will be addressed.