How to Extract Images from PowerPoint in C#

In this how-to tutorial, we will discuss the step-by-step procedure to extract images from PowerPoint in C# using one of the popular document extraction packages with a few simple API calls. Further, we will create a sample application to get images from PowerPoint using C# by consuming the workflow described in this guide so you can use it in your projects for fetching the images from documents. Here are the key steps along with a sample code snippet for extracting images from a PowerPoint file.

Steps to Extract Images from PowerPoint in C#

  1. Setup GroupDocs.Parser for .NET package from the NuGet package manager in the .NET project to extract images from PowerPoint document
  2. Add a reference to the necessary namespaces for extracting images from the PowerPoint file
  3. Initialize the Parser class for loading the input PowerPoint file
  4. Invoke the GetImages method of the Parser class for getting the image collection
  5. Iterate over the collection to get the size, type, and contents of the image

The above points explain the complete workflow of how to get pictures from PowerPoint in C#. You just have to write a few lines of code that contains a couple of API calls to extract images from PPT document. Further, these instructions do not rely on any third-party tool and can be easily followed on any of the common operating systems including Windows, Linux, and macOS.

Code to Extract Images from PowerPoint in C#

In the preceding code snippet, we have developed the functionality to extract images from PowerPoint using C# to demonstrate the working of this feature. This sample code can be easily enhanced or used as it is for getting images from PowerPoint documents. Moreover, you can quickly extract images from other document formats such as PDF, DOC, DOCX, XLSX, and many more using the mentioned document parsing library.

We have discussed the detailed instructions to get images from PowerPoint in C# and developed a sample application for it. Recently, we published an article for extracting Text from XML using C#, have a look at how to Extract Text from XML in C# guide for more information.

 English