Convert PPT to PNG Image using C#

Convert PPT to PNG using C#

MS PowerPoint provides a rich set of multimedia features for professional presentations. PPT/PPTX files are easy to store and convert to other formats. Often you need to turn slides into image files such as PNG. You can achieve this PPT to PNG Image conversion with a C# PowerPoint library. Let’s learn how to convert PPT to PNG using C# programmatically.

We will cover:

C# PowerPoint to Image Rendering Library - Installation

The installation process is developer‑friendly. You can either download this .NET PowerPoint library or install it via NuGet:

Install-Package Aspose.Slides.NET 

Convert PPT to PNG Image using C#

This library offers methods to manipulate, create, and convert PPT/PPTX files programmatically.

Follow these steps and the code snippet to convert PPT to PNG:

  1. Load the source PPT file by creating a Presentation object.
  2. Access Presentation.Slides to get the slide collection.
  3. Assign each slide to the ISlide interface.
  4. Call GetThumbnail for each slide and use Save to write the PNG file.

The code below converts a PPT/PPTX presentation to PNG images in C#:

Result example:

PPT to PNG

PPTX to PNG with Custom Size in C#

Here’s how to set custom dimensions for the output PNG files.

Steps:

  1. Create a Presentation instance and load the PPT file.
  2. Define scaleX and scaleY to set custom dimensions.
  3. Loop through all Slides.
  4. Get the thumbnail with the custom size and Save it as PNG.

Sample code:

Output screenshot:

PPT to PNG conversion

PowerPoint to PNG with Custom Dimension in C#

Now we’ll customize the PNG dimensions using the Size constructor.

Steps:

  1. Initialize a Presentation object and load the source PPT.
  2. Set the desired PNG size with the Size constructor.
  3. Iterate through all Slides.
  4. Use GetThumbnail with the custom size and Save each slide as PNG.

Code example:

Get a Free License

You may get a free temporary license to try the API without evaluation limitations.

Summing up

We have shown how to convert PPT PPTX to PNG image using C# programmatically and highlighted additional features of this C# PowerPoint library. Visit the documentation for more methods. Stay connected with conholdate.com for updates.

Ask a question

You can share your questions on our forum.

FAQs

Can we convert PPT to image?

Yes. Install this C# PowerPoint library to convert PPT to image formats programmatically.

How do I convert a PPT to a PNG?

Follow this link to automate PPT/PPTX to PNG conversion in a C# application.

See Also