Export a PowerPoint Presentation Slide as PNG Image Using Aspose.Slides for .NET

Hi, can you provide sample code exporting a given slide of presentation (say slide index 0 or whatever) as image, png.

I need to create a method that takes slide number and return stream of png export of slide

thank’s

Hi,

Thank you for contacting support.

Yes, Aspose.Slides for .NET does provide a feature to convert the slides in a presentation to images. Please see the following documentation link with sample code and details.

Creating Slides Thumbnail Image

In case you need any further assistance, please feel free to contact support.

Thanks & Regards,

Hi,

I have observed the requirements shared. Please try using the following sample code to serve the purpose.

public static MemoryStream GenPPTXThumbs(String presName, String path, int iSlideIndex)
{
    // String path=“D:\Aspose Data\”;
    Presentation pres = new Presentation(path + presName);
    ISlide sld = pres.Slides[iSlideIndex];
    Bitmap image = sld.GetThumbnail(1.0f, 1.0f);
    MemoryStream stream = new MemoryStream();

    image.Save(stream, System.Drawing.Imaging.ImageFormat.Png);
    stream.Position = 0;

    return stream;
}

Many Thanks,

ok, your code works great!
But… how can i set final image resolution? Need to get at least 200 dpi resolution png from slides pages

thank’s a lot

Hi,

I like to share that the default image resolution with scaling factor 1.0f is 72 DPI. So in order to get image of 200 DPI, you need following replacement on your end.

slide.GetThumbnail(200/72, 200/72);

Please make necessary change in your code as per above suggestion to get desired DPI. Please, share if I may help you further in this regard.

Many Thanks,

and if I want 300 DPI jpg image, so I will update it to slide.GetThumbnail(300/72, 300/72); if I’m correct.

@ELSSAM_elsevier_com,
There have been many updates to Aspose.Slides for .NET since 2014. Please describe the issue you are experiencing in a new forum thread.