Not able to convert EMF to Png using Aspose Imaging


#1

I tried converting EMF file using aspose imaging using various code examples provided by Aspose forums. But all are exporting empty image.
images.zip (4.6 KB)

                   String filePath = "C:\\Projects\\gdcp\\Picture1.emf";
		License license = new License();
		license.setLicense(ASPOSE_LICENSE);
		EmfMetafileImage metafile = new EmfMetafileImage(filePath);

		metafile.setBackgroundColor(Color.getWhiteSmoke());
		metafile.save("C:\\Projects\\gdcp\\Picture1.png", new PngOptions());
		metafile.close();

Above is one of the sample code, i have tried many other options but none are working.

Kindly help me in fixing this.


#2

@mehul14837,

I have observed the issue shared by you and an issue with ID IMAGINGJAVA-1312 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.


#3

Thank you Mudassir. Kindly update whenever you are able to get some information. I am stuck right now and have production release soon.


#4

@mehul14837,

We will share good news with you as soon as possible.


#5

Hello Mudassir,

Any update on this?


#6

@mehul14837,

I have verified from our issue tracking system and like to share that issue has just recently been created in our issue tracking system and is pending for investigation at the moment. We request for your patience till the time the issue gets scheduled and resolved.


#7

@mehul14837,

I request you to please try using following sample code on your end to serve the purpose:

using (Image image = Image.Load("Picture1.emf"))
{
    image.Save(
        "Picture1.png",
        new PngOptions()
            {
                VectorRasterizationOptions = new EmfRasterizationOptions()
                                                 {
                                                     PageSize = image.Size
                                                 }
            });
}

#8

Thank you for the update but still image is coming as blank. Note that the code you provided is .Net code, I wrote compatible java code for the same as below:

String filePath = “C:\Projects\gdcp\Picture1.emf”;
String newFilePath = “C:\Projects\gdcp\Picture1.png”;
String AL = “C:\Projects\gdcp\meta\license\Aspose.Total.Java.lic”;
com.aspose.imaging.License license = new com.aspose.imaging.License();
license.setLicense(AL);

	Image image = Image.load(filePath);
	PngOptions pngOptions = new PngOptions();
	EmfRasterizationOptions emf = new EmfRasterizationOptions();
	emf.setPageSize(image.getSize().to_SizeF(image.getSize()));
	pngOptions.setVectorRasterizationOptions(emf);
	image.save(newFilePath, pngOptions);

#9

@mehul14837,

Can you please share generated result along with environment details so that we may further investigate to help you out.