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