importuuidfromgroupdocs.parserimportParserparser=Parser(file_path)images=parser.get_images()ifimagesisNone:print("Page images extraction isn't supported")else:forimageinimages:# Save the image to a file with a unique nameimage.save(f"{uuid.uuid4()}{image.file_type.extension}")
save
Saves the image to the file in a different format.
defsave(self,file_path,options):...
Parameter
Type
Description
file_path
str
The path to the file.
options
ImageOptions
The options which are used to save the image.
Example
importuuidfromgroupdocs.parserimportParserfromgroupdocs.parser.optionsimportImageOptions,ImageFormat# Initialize parser for the source documentparser=Parser(file_path)# Extract images from the documentimages=parser.get_images()ifimagesisNone:print("Page images extraction isn't supported")else:# Create options to save images in PNG formatoptions=ImageOptions(ImageFormat.Png)forimageinimages:# Save each image to a PNG file with a unique nameimage.save(f"{uuid.uuid4()}.png",options)