Read the complete article on generating thumbnails of PowerPoint PPTX/PPT presentations using C#: https://blog.aspose.com/2021/08/30/generate-pptx-thumbnails-using-csharp/
Last active
August 31, 2021 05:39
-
-
Save aspose-com-gists/303d1ecc4588599fd3bb67700f7e3b7e to your computer and use it in GitHub Desktop.
Generate Thumbnails of PowerPoint PPTX PPT in C#
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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