Image

An image depicted in a Picture shape can be accessed using its image property. The Image object provides access to detailed properties of the image itself, including the bytes of the image file itself.

Image objects

The Image object is encountered as the image property of Picture.

class pptx.parts.image.Image[source]

Immutable value object representing an image such as a JPEG, PNG, or GIF.

blob

The binary image bytestream of this image.

content_type

MIME-type of this image, e.g. 'image/jpeg'.

dpi

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

Canonical 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

The filename from the path from which this image was loaded, if loaded from the filesystem. None if no filename was used in loading, such as when loaded from an in-memory stream.

sha1

SHA1 hash digest of the image blob

size

A (width, height) 2-tuple specifying the dimensions of this image in pixels.