Convert PPT to PNG Image using C#

Convert PPT to PNG using C#

MS PowerPoint is a powerful tool that offers a rich stack of multimedia options to make your presentation even more professional and attractive. PPT/PPTX files are easy to store and convert to any other popular file format. However, in many scenarios, you need to convert your presentation slides to any other image format such as PNG. Interestingly, you may achieve this PPT to PNG Image conversion using this C# PowerPoint library. Therefore, let’s learn how to convert PPT to PNG using C# programmatically.

We will cover the following points:

C# PowerPoint to Image Rendering Library - Installation

The installation procedure of this API is developer-friendly. However, you can either download this .NET PowerPoint library or install it by running the following commands in the NuGet package manager.

Install-Package Aspose.Slides.NET 

Convert PPT to PNG Image using C#

This library provides rich methods to manipulate, create and convert PPT/PPTX files to other file formats programmatically.

You may follow the following steps and the code snippet to convert PPT to PNG:

  1. Load the source PPT file by initializing an instance of the Presentation class.
  2. Access the property Presentation.Slides which returns a list of all slides that are defined in the presentation.
  3. Assign the slides to the ISlide interface.
  4. Invoke the GetThumbnail method to get the thumbnail for every slide and call the Save method to save the slides in PNG format.

The following code snippet shows how to convert a PPT PPTX Presentation to a PNG image in C#:

You may see the output in the image below:

PPT to PNG

PPTX to PNG with Custom Size in C#

In this section, we will see how can we configure the API call to customize the size of the output PNG file.

Following are the steps and the code snippet:

  1. Instantiate an instance of the Presentation class and load the source PPT file.
  2. Set the custom dimensions by defining the scaleX, and scaleY values.
  3. Loop through all the Slides.
  4. Get the thumbnail with the custom dimensions and Save the slides in PNG format.

The sample code below demonstrates how to render PPTX to PNG image in C#:

You may see the output in the screenshot below:

PPT to PNG conversion

PowerPoint to PNG with Custom Dimension in C#

So far, we have learned how to convert PPT to PNG using C# programmatically. Therefore, let’s see how can we customize the dimensions of the PNG file using this C# PowerPoint library.

The steps and the code snippets are mentioned below:

  1. Initialize an object of the Presentation class and load the source PPT file.
  2. Set the custom size of the PNG files by initializing the value of the Size constructor.
  3. Loop through all the Slides.
  4. Invoke the GetThumbnail method to obtain the thumbnail of custom size and Save the slides in PNG format.

The following code sample demonstrates how to export a PowerPoint PPTX presentation to PNG image in C#:

Get a Free License

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

Summing up

This brings us to the end of this blog post. We have gone through how to convert PPT PPTX to PNG image using C# programmatically. In addition, we also have covered some other prominent methods of this C# PowerPoint library. However, you may visit the documentation to learn other methods. Finally, please stay in touch with conholdate.com for regular updates.

Ask a question

You can let us know about your questions or queries on our forum.

FAQs

Can we convert PPT to image?

Yes, you can install this C# PowerPoint library to convert PPT to image file formats programmatically.

How do I convert a PPT to a PNG?

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

See Also