Skip to content

Instantly share code, notes, and snippets.

@groupdocscloud
Last active October 22, 2020 14:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save groupdocscloud/e9df272d0718fb23d69ddc538caafb76 to your computer and use it in GitHub Desktop.
Save groupdocscloud/e9df272d0718fb23d69ddc538caafb76 to your computer and use it in GitHub Desktop.
Extract Images from Documents in Python
# Extract images from Word documents, Excel spreadsheets, Presentations in Python.
options.file_info.file_path = "documents/doc-with-images.docx"
# Just change the document path according to requirement (doc/docx, xls/xlsx, ppt/pptx, ...)
request = groupdocs_parser_cloud.ImagesRequest(options)
result = parseApi.images(request)
# How to extract images from Word documents, Excel spreadsheets, Presentations or PDF document in Python.
import groupdocs_parser_cloud
class ExtractImagesFromPDF:
@classmethod
def Run(cls):
# Obtain the APP SID and APP Key from https://dashboard.groupdocs.cloud/
configuration = groupdocs_parser_cloud.Configuration("xxxx-APP-SID-xxx", "xxxx APP KEY xxx")
configuration.api_base_url = "https://api.groupdocs.cloud"
parseApi = groupdocs_parser_cloud.ParseApi.from_config(configuration)
options = groupdocs_parser_cloud.ImagesOptions()
options.file_info = groupdocs_parser_cloud.FileInfo()
options.file_info.file_path = "documents/doc-with-images.pdf"
request = groupdocs_parser_cloud.ImagesRequest(options)
result = parseApi.images(request)
# Display properties of extracted Images
for image in result.images:
print("Path: " + image.path)
print("Download url: " + image.download_url)
print("Image format: " + image.file_format)
print("Page index: " + str(image.page_index))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment