Free Support Forum -

Png files in aspose slides have a bigger bounding box than the image itself

Please see the attached image
image.png (57.5 KB)

Here is the code

using Aspose.Slides;
using Aspose.Slides.Export;
using Aspose.Svg;
using Aspose.Svg.Rendering.Image;
using System;
using System.Drawing;
using System.Net;
using System.Net.Http;
using System.Threading.Tasks;

namespace UbuntuAsposeApp
class Program
static void Main(string[] args)

        using (var document = new SVGDocument("App_Data/test.svg"))
            using (var device = new ImageDevice(new ImageRenderingOptions(ImageFormat.Png), "targetfile.png"))

        using (Presentation presentation = new Presentation("App_Data/sample.pptx"))

            IFontData sourceFont = new FontData("Roboto Light");

            IFontData destFont = new FontData("Arial");

            sourceFont = new FontData("Roboto Thin");

            PdfOptions options = new PdfOptions();

            options.TextCompression = PdfTextCompression.Flate;
            // Define the PDF standard
            options.Compliance = PdfCompliance.Pdf15;
            var svgContent = System.IO.File.ReadAllText("App_Data/test.svg");
      //     var svgContent = System.IO.File.ReadAllText("SVG.svg");
            ISvgImage svgImage = new SvgImage(svgContent);
            var emfImage = presentation.Images.AddImage(svgImage);
           presentation.Slides[0].Shapes.AddPictureFrame(ShapeType.Rectangle, 0, 0, emfImage.Width, emfImage.Height, emfImage);

            Image img = (Image)new Bitmap("targetfile_1.png");
            IPPImage imgx = presentation.Images.AddImage(img);

           presentation.Slides[1].Shapes.AddPictureFrame(ShapeType.Rectangle, 0, 0, 425, 200, imgx);


            presentation.Save("SVG.pptx", SaveFormat.Pptx);
            presentation.Save("SVG.pdf", SaveFormat.Pdf, options);





the image files can be found here PPTX and PDF not showing the image correctly


Are you referring to following presentation file?

In your sample code you are creating PDF by adding SVG to slide picture frame. However in your issue title, you have mentioned that PNG file have bigger bounding box? Can you please elaborate the issue along with actually generated output with us so that we may investigate it further on our end.

I meant the svg I’m using is the same in that code. but the code I’m using is the one I pasted above. I’m converting that svg into png and then putting the png in the powerpoint


I have worked with sample code shared by you for attached SVG on my end. The PNG generated by Aspose.SVG seems to have extra white space or right and bottom of chart image. I am moving this thread to concerned forum where our respective support team will assist you further in this regard. (32.5 KB)

HI Mudassir,

its no that if you use the aspose svg converter I used that as an example it happens with just regular png files too


I have observed issue you mentioned and have logged it as SVG-30 in our issue tracking system. We will further look into details of the issue and keep you posted with the status of its correction. Please be patient and spare us little time.

We are sorry for the inconvenience.