
Thumbnails are small‑size previews that make it easier to scan large image collections. Microsoft PowerPoint also creates thumbnail images for each slide, enabling fast navigation through a deck. In this article you will learn how to generate thumbnails of PowerPoint PPTX or PPT files using C#. These techniques are useful when building custom web or desktop PowerPoint viewers, slide galleries, or preview generators.
- .NET API to Generate Thumbnails for PowerPoint PPTX/PPT
- Generate Thumbnails for PPTX/PPT using C#
- Generate Thumbnails with User-Defined Dimensions
.NET API to Generate Thumbnails for PowerPoint PPTX/PPT
To create slide thumbnails from PPTX or PPT files we use Aspose.Slides for .NET. This robust library lets you read, edit, and convert PowerPoint presentations programmatically. You can obtain the library by downloading it from the official site or adding it to your project via NuGet.
PM> Install-Package Aspose.Slides.NET
Generate Thumbnails for PPTX or PPT using C#
Follow these steps to extract a thumbnail image from each slide in a presentation:
- Instantiate a Presentation object and load the target PPTX/PPT file.
- Iterate through the Presentation.Slides collection, accessing each ISlide.
- Call ISlide.GetThumbnail(1f, 1f) to render the slide at its original size and store the result in a Bitmap object.
- Save the bitmap to the desired image format using Bitmap.Save(String, System.Drawing.Imaging.ImageFormat).
The code snippet below demonstrates the complete process.
Generate Thumbnails with User-Defined Dimensions
You can control the output size of each thumbnail by adjusting the slide dimensions before rendering. Use the Presentation.SlideSize.Size.Width and Presentation.SlideSize.Size.Height properties to set custom width and height values, then generate the thumbnail with those scaled dimensions.
Steps:
- Load the presentation with a new Presentation instance.
- Set the desired thumbnail width and height via the Width and Height properties.
- Loop through each ISlide in the Presentation.Slides collection.
- Generate a scaled thumbnail using ISlide.GetThumbnail(Single, Single) and capture it in a Bitmap.
- Save the bitmap to your chosen image format with Bitmap.Save.
The following example shows how to produce thumbnails with custom dimensions.
Get a Free API License
Remove evaluation restrictions by requesting a temporary license for Aspose.Slides for .NET. This allows unrestricted use during development and testing.
Conclusion
You now know how to generate slide thumbnails from PowerPoint PPTX or PPT files using C#. The guide covered both default‑size thumbnails and custom‑dimension thumbnails. Explore additional capabilities in the documentation and feel free to ask questions on our forum.