Return (rId, image) pair for image identified by `image_descriptor`. `rId` is the str key (often like "rId7") for the relationship between this story part and the image part, reused if already present, newly created if not. `image` is an |Image| instance providing access to
(self, image_descriptor: str | IO[bytes])
| 25 | """ |
| 26 | |
| 27 | def get_or_add_image(self, image_descriptor: str | IO[bytes]) -> Tuple[str, Image]: |
| 28 | """Return (rId, image) pair for image identified by `image_descriptor`. |
| 29 | |
| 30 | `rId` is the str key (often like "rId7") for the relationship between this story |
| 31 | part and the image part, reused if already present, newly created if not. |
| 32 | `image` is an |Image| instance providing access to the properties of the image, |
| 33 | such as dimensions and image type. |
| 34 | """ |
| 35 | package = self._package |
| 36 | assert package is not None |
| 37 | image_part = package.get_or_add_image_part(image_descriptor) |
| 38 | rId = self.relate_to(image_part, RT.IMAGE) |
| 39 | return rId, image_part.image |
| 40 | |
| 41 | def get_style(self, style_id: str | None, style_type: WD_STYLE_TYPE) -> BaseStyle: |
| 42 | """Return the style in this document matching `style_id`. |