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

Free Support Forum - aspose.com

Aspose.Slides for Java: How to Reduce Size of PPTX when Inserting SVG Images?

Is there a way to reduce the size of the PPTX by removing the extraneous images when inserting SVG images to the blank PPTX presentation slide?
It appears that generated PPTX contains BOTH original SVG image and also the same image in PNG format under ppt/images folder, which drastically increased the size of generated PowerPoint presentation.

@oraspose,
You are right, when an SVG image is added to a presentation, a PNG copy of it is also added to the document. This is done for backwards compatibility in order to open such a presentation in an application that does not support SVG images. Unfortunately, this increases the size of PowerPoint files. To avoid this, you can use EMF images instead of SVG.

Can some flag be added that if set to ‘true’ would disallow including PNG copy of the images?
Alternatively, what should be used to insert image into PPTX presentation as EMF instead of SVG?
Below is a small code snippet of the way it’s done currently (where imagebytes is a byte array of the image):

        ISlide islide = slides.get_Item(lastSlideNumber);
        final IPPImage imgx;
        if (isSVG(imagebytes) ) {
            ISvgImage svgImage = new SvgImage(imagebytes);
            imgx = pptx.getImages().addImage(svgImage);
        } else {
            imgx = pptx.getImages().addImage(imagebytes);
        }

@oraspose,

No, this behavior is not specific to Aspose.Slides, but to PowerPoint documents.

Perhaps you could use Aspose.Imaging for such a conversion. You can try our free online converter to test your results. It works based on Aspose.Imaging. Please feel free to ask any questions about this library on Aspose.Imaging forum.

A post was split to a new topic: getBinaryData Method Seems To Do the SVG to EMF Conversion