Generate a reference to each |ImagePart| object in the package.
(self)
| 130 | self._package = package |
| 131 | |
| 132 | def __iter__(self) -> Iterator[ImagePart]: |
| 133 | """Generate a reference to each |ImagePart| object in the package.""" |
| 134 | image_parts = [] |
| 135 | for rel in self._package.iter_rels(): |
| 136 | if rel.is_external: |
| 137 | continue |
| 138 | if rel.reltype != RT.IMAGE: |
| 139 | continue |
| 140 | image_part = rel.target_part |
| 141 | if image_part in image_parts: |
| 142 | continue |
| 143 | image_parts.append(image_part) |
| 144 | yield image_part |
| 145 | |
| 146 | def get_or_add_image_part(self, image_file: str | IO[bytes]) -> ImagePart: |
| 147 | """Return |ImagePart| object containing the image in `image_file`. |