load pixel-doubled width and height from image data
(self)
| 1235 | |
| 1236 | |
| 1237 | def _retina_shape(self): |
| 1238 | """load pixel-doubled width and height from image data""" |
| 1239 | if not self.embed: |
| 1240 | return |
| 1241 | if self.format == self._FMT_PNG: |
| 1242 | w, h = _pngxy(self.data) |
| 1243 | elif self.format == self._FMT_JPEG: |
| 1244 | w, h = _jpegxy(self.data) |
| 1245 | elif self.format == self._FMT_GIF: |
| 1246 | w, h = _gifxy(self.data) |
| 1247 | else: |
| 1248 | # retina only supports png |
| 1249 | return |
| 1250 | self.width = w // 2 |
| 1251 | self.height = h // 2 |
| 1252 | |
| 1253 | def reload(self): |
| 1254 | """Reload the raw data from file or URL.""" |