__init__ constructor

On this page

init

Initializes a new instance of the PageImageArea class.

def __init__(self, image_stream, file_type, rotation):
    ...
Parameter Type Description
image_stream io.RawIOBase The stream of the image.
file_type FileType The format of the image.
rotation float The rotation angle of the image.

init

Initializes a new PageImageArea instance.

def __init__(self, image_stream, file_type, rotation, page, rectangle):
    ...
Parameter Type Description
image_stream io.RawIOBase The stream of the image.
file_type FileType The format of the image.
rotation float The rotation angle of the image.
page Page The page that contains the image.
rectangle Rectangle The rectangular area that contains the image.

Example

from groupdocs.parser.data import PageImageArea, Page, Rectangle
from groupdocs.parser.options import FileType

# Assume `page_obj` is a `Page` instance obtained from a parsed document
with open("image.png", "rb") as stream:
    area = PageImageArea(
        image_stream=stream,
        file_type=FileType.PNG,
        rotation=0.0,
        page=page_obj,
        rectangle=Rectangle(0, 0, 100, 100)
    )
    # Save the extracted image to a file
    area.save("output.png")

See Also

On this page