MCPcopy Index your code
hub / github.com/python-openxml/python-docx / _add_image_part

Method _add_image_part

src/docx/package.py:80–85  ·  view source on GitHub ↗

Return |ImagePart| instance newly created from `image` and appended to the collection.

(self, image: Image)

Source from the content-addressed store, hash-verified

78 return self._add_image_part(image)
79
80 def _add_image_part(self, image: Image):
81 """Return |ImagePart| instance newly created from `image` and appended to the collection."""
82 partname = self._next_image_partname(image.ext)
83 image_part = ImagePart.from_image(image, partname)
84 self.append(image_part)
85 return image_part
86
87 def _get_by_sha1(self, sha1: str) -> ImagePart | None:
88 """Return the image part in this collection having a SHA1 hash matching `sha1`,

Callers 2

get_or_add_image_partMethod · 0.95

Calls 3

_next_image_partnameMethod · 0.95
appendMethod · 0.95
from_imageMethod · 0.80

Tested by 1