Image
paper-pptx 0.2.0 API reference
Immutable value object representing an image such as a JPEG, PNG, or GIF.
Image(blob: bytes, filename: str | None)Attributes
blob
attributeblobbytesThe binary image bytestream of this image.
content_type
attributecontent_typestrMIME-type of this image, e.g. "image/jpeg".
dpi
attributedpituple[int, int]A (horz_dpi, vert_dpi) 2-tuple specifying the dots-per-inch resolution of this image.
A default value of (72, 72) is used if the dpi is not specified in the image file.
ext
attributeextstrCanonical file extension for this image e.g. 'png'.
The returned extension is all lowercase and is the canonical extension for the content type of this image, regardless of what extension may have been used in its filename, if any.
filename
attributefilenamestr | NoneFilename from path used to load this image, if loaded from the filesystem.
None if no filename was used in loading, such as when loaded from an in-memory stream.
sha1
attributesha1strSHA1 hash digest of the image blob.
size
attributesizetuple[int, int]A (width, height) 2-tuple specifying the dimensions of this image in pixels.
Functions
from_blob
funcfrom_blob(blob: bytes, filename: str | None = None) -> ImageReturn a new Image object loaded from the image binary in blob.
paramblobbytesparamfilenamestr | None= NoneReturns
pptx.parts.image.Imagefrom_file
funcfrom_file(image_file: str | IO[bytes]) -> ImageReturn a new Image object loaded from image_file.
image_file can be either a path (str) or a file-like object.
paramimage_filestr | IO[bytes]Returns
pptx.parts.image.Image