Extract Images from Documents using Python

If you are a Python developer and want to extract data from documents, this article will guide you to extract images from various word processing documents, spreadsheets, presentations, and PDF documents using simple Python examples.

Following topics will be covered today:

Image Extraction REST API and Python SDK

Document Parsing Python SDK

This time, we will use the Python SDK of GroupDocs.Parser Cloud API for the extraction of images from different types of documents. However, currently, it also provides, .NET, Java, PHP, Ruby, and Node.js SDKs as its document parsing family members for the Cloud API.

The API also supports text and metadata extraction along with extracting images from various kinds of documents like word processing documents, spreadsheets, presentations, emails, archives, markup, and PDF documents.

Coming to the objective, first, get your APP KEY and APP SID from the dashboard before you start following the steps and available code examples.

Extract Images from PDF using Python

PDF Document to Extract Images, get images from pdf or extract image from pdf

As an example, first I will be extracting the images from a PDF document. By just following simple steps, all the images can be extracted easily.

  • Upload the PDF document to the Cloud.
  • Extract the images from the uploaded document.
  • Download the extracted images.

Upload the PDF Document

Firstly, upload the PDF document to the Cloud using any of the following methods:

As the result, PDF file will be uploaded at the Cloud Storage

PDF file uploaded at dashboard

Uploaded PDF file at dashboard.groupdocs.cloud/#/files

Extract Images from the Uploaded PDF Document

Now you are done with the difficult part to extract all photos from pdf. Following Python code will let you quickly extract all the images from the uploaded PDF document.

Download the Extracted Images

Once you have extracted the images, you can download the images from the cloud either from dashboard or programmatically. Images shown here are extracted from the above shown PDF document.

Images extracted from a PDF file

Images extracted from the PDF document

Extracted Images from Document using Python

Extract high quality image from pdf, xlsx, pptx or docx file

Image Extraction from Excel, PPT, or Word Docs using Python

Similarly, you can extract all the images from the Word documents, spreadsheets, presentations with the exact above-mentioned python code for PDF document. You just have to change the file path with the correct document name with extension.

Extract Images from Document Online

How to extract images from file or doucment online free? Groupdocs.Parser provides a free online tool to extract images from word online, extract all images from pdf, save all pictures in a powerpoint or extract images from xlsx python. Simply select the document you want to extract jpg, png, jpeg or gif images.

Extract images from pdf online free, extract images from excel online, extract image from word online and extract images from pptx online tools have been developed using the Groupdocs.Parser Python API.


In this article we have learned, how to programmatically extract images from Word, Excel, PowerPoint, PDF, and other documents using Python. No difference in the code, we just have to change the source document path and type.

For more features and to learn more about the document parsing API, visit the documentation for articles which also contain the examples. The best way to test the highlighted features is to experience the open-source running examples from GitHub. In case of any confusion, the GroupDocs Support Team feels delighted to facilitate you. Thanks

Ask a question

If you have any queries regarding how to extract images from PDF, XLSX, PPTX or Word DOCX using Python, please feel free to ask us at Free Support Forum

See Also