load pixel-doubled width and height from image data
(self)
| 1038 | |
| 1039 | |
| 1040 | def _retina_shape(self): |
| 1041 | """load pixel-doubled width and height from image data""" |
| 1042 | if not self.embed: |
| 1043 | return |
| 1044 | if self.format == self._FMT_PNG: |
| 1045 | w, h = _pngxy(self.data) |
| 1046 | elif self.format == self._FMT_JPEG: |
| 1047 | w, h = _jpegxy(self.data) |
| 1048 | elif self.format == self._FMT_GIF: |
| 1049 | w, h = _gifxy(self.data) |
| 1050 | else: |
| 1051 | # retina only supports png |
| 1052 | return |
| 1053 | self.width = w // 2 |
| 1054 | self.height = h // 2 |
| 1055 | |
| 1056 | def reload(self): |
| 1057 | """Reload the raw data from file or URL.""" |