We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Transparency is not set for EMF to PNG converted image

Converted Image.png (2.7 KB)
Expected Image.png (4.9 KB)
Hi team ,
We are converting the emf image to png image using aspose-imaging-21.6-jdk16.jar . Below are the code snippets used to convert the image
> Image image = Image.load(is);

        int w = image.getWidth();
        int h = image.getHeight();
        EmfRasterizationOptions rasterizationOptions = new EmfRasterizationOptions();
        rasterizationOptions.setBackgroundColor(Color.getTransparent());
        rasterizationOptions.setPageWidth(w);
        rasterizationOptions.setPageHeight(h);
        PngOptions pngOptions = new PngOptions();
        pngOptions.setVectorRasterizationOptions(rasterizationOptions);
        image.save(os,pngOptions);

After converting transparency is not set for the image. It has a black background instead of transparency. Also I attached the converted and expected converted images . Kindly do the needfull.Converted Image.png (2.7 KB)
Expected Image.png (4.9 KB)

@Free_Blog, you need to set pngcolortype to truecolorwithalpha when saving to support transparency in png. You can look it here https://docs.aspose.com/imaging/java/developer-guide/how-to/save-transparent-image/