generate PPTX thumbnails in C#

Thumbnails are commonly used to create small-sized versions of the larger images. They make it easier to look at or scroll through the list of images. MS PowerPoint also provides you the thumbnails of the slides in a presentation. Using slides’ thumbnails, you can easily go through the presentation and navigate to a particular slide. In this article, you will learn how to generate thumbnails of PowerPoint PPTX or PPT using C#. This could be useful in scenarios such as when you need to create your own web or desktop-based PowerPoint viewer.

.NET API to Generate Thumbnails for PowerPoint PPTX/PPT

In order to generate thumbnails for PPTX or PPT presentations, we will use Aspose.Slides for .NET. It is a powerful API that lets you create and manipulate PowerPoint and OpenOffice documents. In addition, it allows you to convert presentations to other file formats. You can either download the API or install it using NuGet.

PM> Install-Package Aspose.Slides.NET

Generate Thumbnails for PPTX or PPT using C#

The following are the steps to generate thumbnails of a PPTX presentation using C#.

  1. First, create an instance of the Presentation class to load the presentation.
  2. Loop through each ISlide in Presentation.Slides collection.
  3. Generate thumbnail of the each slide using ISlide.GetThumbnail(1f, 1f) method and get the reference of thumbnail into a Bitmap object.
  4. Finally, save the thumbnail into your desired image format using Bitmap.Save(String, System.Drawing.Imaging.ImageFormat) method.

The following code sample shows how to generate thumbnails of a PPTX presentation using C#.

Generate Thumbnails with User-Defined Dimensions

You can also customize the dimensions of the thumbnails according to your requirement. This can be achieved using Presentation.SlideSize.Size.Width and Presentation.SlideSize.Size.Height properties. The following are the steps to perform this operation.

  1. First, create an instance of the Presentation class to load the presentation.
  2. Then, set the desired dimensions of the thumbnails and scale the values using Width and Height properties.
  3. Loop through each ISlide in Presentation.Slides collection.
  4. Generate thumbnail of the each slide using ISlide.GetThumbnail(Single, Single) method and get the reference of thumbnail into a Bitmap object.
  5. Finally, save the thumbnail into your desired image format using Bitmap.Save(String, System.Drawing.Imaging.ImageFormat) method.

The following code sample shows how to generate thumbnails of a PPTX with customized dimensions.

Get a Free API License

You can use Aspose.Slides for .NET without evaluation limitations by requesting a temporary license.

Conclusion

In this article, you have learned how to generate thumbnails of PowerPoint PPTX or PPT using C#. Furthermore, you have seen how to generate thumbnails with desired dimensions. In addition, you can visit the documentation to explore other features of API. Also, you can feel free to let us know about your queries via our forum.

See Also