MCPcopy Create free account
hub / github.com/scanny/python-pptx / get_or_add_image_part

Method get_or_add_image_part

src/pptx/package.py:32–38  ·  view source on GitHub ↗

Return an |ImagePart| object containing the image in *image_file*. If the image part already exists in this package, it is reused, otherwise a new one is created.

(self, image_file: str | IO[bytes])

Source from the content-addressed store, hash-verified

30 return core_props
31
32 def get_or_add_image_part(self, image_file: str | IO[bytes]):
33 """
34 Return an |ImagePart| object containing the image in *image_file*. If
35 the image part already exists in this package, it is reused,
36 otherwise a new one is created.
37 """
38 return self._image_parts.get_or_add_image_part(image_file)
39
40 def get_or_add_media_part(self, media):
41 """Return a |MediaPart| object containing the media in *media*.

Calls

no outgoing calls