image
image
¶
The proxy class for an image part, and related objects.
ImagePart
¶
Bases: Part
An image part.
Corresponds to the target part of a relationship with type RELATIONSHIP_TYPE.IMAGE.
Source code in src/docx/parts/image.py
default_cx
property
¶
Native width of this image, calculated from its width in pixels and horizontal dots per inch (dpi).
default_cy
property
¶
Native height of this image, calculated from its height in pixels and vertical dots per inch (dpi).
filename
property
¶
Filename from which this image part was originally created.
A generic name, e.g. 'image.png', is substituted if no name is available, for example when the image was loaded from an unnamed stream. In that case a default extension is applied based on the detected MIME type of the image.
from_image
classmethod
¶
Return an ImagePart instance newly created from image and assigned
partname.
load
classmethod
¶
load(
partname: PackURI,
content_type: str,
blob: bytes,
package: OpcPackage,
)
Called by docx.opc.package.PartFactory to load an image part from a
package being opened by Document(...) call.