Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aspose-com-gists/303d1ecc4588599fd3bb67700f7e3b7e to your computer and use it in GitHub Desktop.
Save aspose-com-gists/303d1ecc4588599fd3bb67700f7e3b7e to your computer and use it in GitHub Desktop.
Generate Thumbnails of PowerPoint PPTX PPT in C#
// Load PowerPoint presentation
using (Presentation pres = new Presentation("presentation.pptx"))
{
// User defined dimension
int desiredX = 1200;
int desiredY = 800;
// Getting scaled value of X and Y
float ScaleX = (float)(1.0 / pres.SlideSize.Size.Width) * desiredX;
float ScaleY = (float)(1.0 / pres.SlideSize.Size.Height) * desiredY;
foreach (ISlide sld in pres.Slides)
{
// Create a full scale image
Bitmap bmp = sld.GetThumbnail(ScaleX, ScaleY);
// Save the image to disk in JPEG format
bmp.Save(String.Format("slide_{0}.jpg", sld.SlideNumber), System.Drawing.Imaging.ImageFormat.Jpeg);
}
}
// Load PowerPoint presentation
using (Presentation pres = new Presentation("presentation.pptx"))
{
foreach (ISlide sld in pres.Slides)
{
// Create a full scale image
Bitmap bmp = sld.GetThumbnail(1f, 1f);
// Save the image to disk in JPEG format
bmp.Save(String.Format("slide_{0}.jpg", sld.SlideNumber), System.Drawing.Imaging.ImageFormat.Jpeg);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment