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

Free Support Forum - aspose.com

Export a slide as png

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,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

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,