Free Support Forum - aspose.com

Error while saving picture in EMF format

Uploaded both the file and the code needed to reproduce it
When trying to save a file with an EMF image we get the following stack trace:
class com.aspose.imaging.coreexceptions.ImageSaveException: Image export failed. —> class com.aspose.imaging.internal.Exceptions.ArgumentException: The rectangle has no common processing area. Cannot proceed.
com.aspose.imaging.Image.getFittingRectangle(Unknown Source)
com.aspose.imaging.Image.getFittingRectangle(Unknown Source)
com.aspose.imaging.internal.cf.d.a(Unknown Source)
com.aspose.imaging.internal.cf.c.saveArgb32Pixels(Unknown Source)
com.aspose.imaging.internal.W.bi.process(Unknown Source)
com.aspose.imaging.internal.W.aZ$b.process(Unknown Source)
com.aspose.imaging.internal.W.bx.process(Unknown Source)
com.aspose.imaging.RasterImage$a.a(Unknown Source)
com.aspose.imaging.internal.W.bj.a(Unknown Source)
com.aspose.imaging.internal.W.bj.a(Unknown Source)
com.aspose.imaging.internal.W.bj.a(Unknown Source)
com.aspose.imaging.RasterImage.getDefaultPixels(Unknown Source)
com.aspose.imaging.RasterImage$d.loadPartialArgb32Pixels(Unknown Source)

com.aspose.imaging.Image.save(Unknown Source)

@danielbeni

Can you please try using latest Aspose.Imaging for Java 20.11 on your end and in case there is still an issue please share the feedback with us in the form of source code and source file reproducing the issue.

@mudassir.fayyaz
I try uploading a zip with code + file, unfortunately it always fails.
Is there a different way to send you the files?

@danielbeni

You may upload files on any file server and share download link with us.

example.zip (167.2 KB)
It’s a tar.gz file

@danielbeni

Can you please share the source file that is actually throwing exception as I am unable to find source image file in your zip file.

Hi Mudassir,
It’s the emf image inside the docx file (test.docx).
If you run the java Test function with file path as the argument you should be able to get the error

@danielbeni

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

Were you able to reproduce it?

@danielbeni

As per your explanation is thrown on following line

image.save(output, getPngOptions(image, image.getFileFormat()));

However, using latest Aspose.Imaging for Java 20.12 and Aspose.Words for Java 21.1, I am able to save to PNG. Can you please use the specified version.

TestImage.zip (18.5 KB)
saved.png (38.9 KB)

@danielbeni

Can you please confirm on your end.