Use image areas to inspect page coordinates, image types, and to save embedded resources in the desired format.
Save images to streams
fromgroupdocs.parserimportParserwithParser("brochure.pdf")asparser:images=parser.get_images()ifimagesisNone:print("Image extraction isn't supported for this format.")else:forimage_areainimages:withimage_area.get_image_stream()asstream:data=stream.read()print(f"Read {len(data)} bytes from page {image_area.page.index+1}")
The following sample file is used in this example: brochure.pdf
Tips
PageImageArea exposes rectangle, page, and file_type so you can filter by size or format.
Use save(path) for convenience or get_image_stream() when you need to process bytes in memory.
For large documents, stop iterating once you have saved the images you need to minimize memory usage.
Was this page helpful?
Any additional feedback you'd like to share with us?
Please tell us how we can improve this page.
Thank you for your feedback!
We value your opinion. Your feedback will help us improve our documentation.