ImagePlacement

ImagePlacement

Overview

ImagePlacement is a class in Aspose.PDF FOSS for Python.

Represent an image placed on a PDF page.

This class provides 4 methods for working with ImagePlacement objects in Python programs. Available methods include: __init__, hide, replace, save. All public members are accessible to any Python application after installing the Aspose.PDF FOSS for Python package. Properties: bits_per_component, color_space, height, image_data, matrix, name, and 5 more.

Properties

NameTypeAccessDescription
image_databytesReadReturn the current image payload.
rectangleRectangleReadBounding rectangle of the image on the page (x, y, width, height in PDF points).
resolutiontuple[float, float]ReadImage resolution as (horizontal_dpi, vertical_dpi).
rotationintReadRotation angle in degrees (0, 90, 180, 270).
matrixtuple[float, float, float, float, float, float]ReadPDF transformation matrix (a, b, c, d, e, f).
widthint | NoneReadPixel width from the image XObject, when known.
heightint | NoneReadPixel height from the image XObject, when known.
bits_per_componentint | NoneReadBits per colour component, when known.
color_spacestr | NoneReadResolved colour-space kind (gray/rgb/cmyk/indexed).
name``ReadGets the name.
page_index``ReadGets the page index.

Methods

SignatureDescription
__init__(name: str, image_data: bytes | bytearray, page_index: int, rect: Rectangle | None, resolution: tuple[float, float] | None, rotation: int, matrix: tuple[float, float, float, float, float, float] | None, meta: dict | None, limits: PdfLoadLimits | None)Calls init(name, image_data, page_index, rect, resolution, rotation, matrix, meta, limits) on this ImagePlacement instance.
replace(new_image_data: bytes | bytearray)Replace the current image data with new_image_data.
save(path: str | os.PathLike, color_space: str | None)PathSave the image as a real, openable image file.
hide()Hide the image placement.

See Also