Convert PPT/PPTX to PNG in C#

It is not uncommon that we may need to convert a PowerPoint file to images or a PDF file in our work. In my previous post, I have introduced how to export PPT/PPTX files as PDFs. This article will introduce how we can convert a PPT/PPTX file into PNGs by using Spire.Presentation in C#.

Here come the code snippets:

using Spire.Presentation;
using System.Drawing;

namespace Conversion
    class Program
        static void Main(string[] args)
            //Initialize an instance of Presentation class
            Presentation presentation = new Presentation();

            //Load a PowerPoint document

            //Traverse each slide in PowerPoint and save as png image
            for (int i = 0; i < presentation.Slides.Count; i++)
                Image image = presentation.Slides[i].SaveAsImage();
                String fileName = String.Format("Result-{0}.png", i);