Convert emf to png is corrupted

Hi,
I use the following code to convert emf to png.
When run the code on linux distributions the created png is corrupted.

public class EmfToPng {
public static void main(String… args)
{
try (EmfImage emfImage = (EmfImage) Image.load(“image.emf”))
{
PngOptions pngOptions = new PngOptions();
pngOptions.setColorType(PngColorType.TruecolorWithAlpha);
VectorRasterizationOptions rasterizationOptions = new EmfRasterizationOptions();
if (rasterizationOptions != null) {
rasterizationOptions.setPageSize(new SizeF(emfImage.getWidth(), emfImage.getHeight()));
rasterizationOptions.setBackgroundColor(emfImage.hasBackgroundColor() ? emfImage.getBackgroundColor() : Color.getTransparent());
pngOptions.setVectorRasterizationOptions(rasterizationOptions);
}
emfImage.save(“image.png”, pngOptions);
}
}

}

Origin image.emf:
image.png (11.0 KB)
image.png - running on windows (OK):
image.png (44.6 KB)
image.png - running on kali (corrupted):
image.png (101.1 KB)
image.png - running on rhel linux (corrupted):
image.jpg (83.6 KB)

Thanks

Hello, @yifatb,
Could you attach the emf sample causing the exception? So we can explore the issue and provide a feedback then.

image.7z (5.5 KB)

@yifatb Thanks for provided file, we will investigate and answer.

@yifatb We have investigated issue and found, that you need to specify folder with fonts for rendering. You have such fonts in your file: M.S. Gothic, Arial UI, Calibri. You need to add fonts to separate folder and specify path to it using FontSettings.SetFontsFolder(@"c:\Users\USER\Downloads\fonts");
You can view more at Manipulating Metafiles|Documentation or Manipulating Metafiles|Documentation