PageImageArea class

PageImageArea class

Represents a page image area used to represent an image on a page in template parsing or an image attachment extracted from emails or Zip archives.

An instance of PageImageArea is returned by the following methods:

See the usage examples there.

The PageImageArea type exposes the following members:

Constructors

Constructor Description
init Initializes a new instance of the PageImageArea class.
init Initializes a new PageImageArea instance.

Methods

Method Description
get_image_stream Returns the image stream.
get_image_stream Returns the image stream in a different format.
get_image_stream_image_options
save Saves the image to the file.
save Saves the image to the file in a different format.
save_file
save_string

Properties

Property Description
file_type The format of the image as a FileType instance.
rotation The rotation angle of the image.
page The document page information such as page index and page size. (inherited from PageArea)
rectangle The rectangular area of the page as a Rectangle. (inherited from PageArea)

Example

from groupdocs.parser import Parser

parser = Parser("sample.docx")
# Iterate over image areas on each page
for img_area in parser.get_images():
    # Save each image to a file; the page number can be used in the filename
    img_area.save(f"output/image_page_{img_area.page}.png")

See Also