An `Image` proxy object for the image in this (picture) drawing. Raises `ValueError` when this drawing does contains something other than a picture. Use `.has_picture` to qualify drawing objects before using this property.
(self)
| 45 | |
| 46 | @property |
| 47 | def image(self) -> Image: |
| 48 | """An `Image` proxy object for the image in this (picture) drawing. |
| 49 | |
| 50 | Raises `ValueError` when this drawing does contains something other than a picture. Use |
| 51 | `.has_picture` to qualify drawing objects before using this property. |
| 52 | """ |
| 53 | picture_rIds = self._drawing.xpath(".//pic:blipFill/a:blip/@r:embed") |
| 54 | if not picture_rIds: |
| 55 | raise ValueError("drawing does not contain a picture") |
| 56 | rId = picture_rIds[0] |
| 57 | doc_part = self.part |
| 58 | image_part = doc_part.related_parts[rId] |
| 59 | return image_part.image |