What is the preferred way to convert WMF to PNG


#1

Code 1

Image image = Image.load(inputFileName);
final EmfRasterizationOptions emfRasterizationOptions = new EmfRasterizationOptions();
emfRasterizationOptions.setPageWidth(image.getWidth());
emfRasterizationOptions.setPageHeight(image.getHeight());
PngOptions options = new PngOptions();
options.setVectorRasterizationOptions(emf);
image.save(outputFileName, options);

Code 2

WmfMetafileImage image = new WmfMetafileImage(new ByteArrayInputStream(inputBytes));
image.save(outputFileName, new PngOptions());

Code 1 comes from Aspose.Imaging for Java
Code 2 comes from Aspose forum
So which one is preferable(better)?


#2

@edward852,

I have observed your requirements and suggest you to please try using sample examples given over this documentation link. Please feel free to share if there is any further help needed in this regard.


#3

@mudassir.fayyaz However, I found that using code 2 to convert WMF is faster and better(quality)…
What’s the difference between these 2 code snippets?


#4

@edward852,

I have observed your comments. I like to inform that both sample codes are almost same except in second sample code you can set borders and background colour. Please share feedback with us if there is still an issue.