MCPcopy Create free account
hub / github.com/ipython/ipython / _retina_shape

Method _retina_shape

IPython/core/display.py:1237–1251  ·  view source on GitHub ↗

load pixel-doubled width and height from image data

(self)

Source from the content-addressed store, hash-verified

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."""

Callers 2

__init__Method · 0.95
reloadMethod · 0.95

Calls 3

_pngxyFunction · 0.85
_jpegxyFunction · 0.85
_gifxyFunction · 0.85

Tested by

no test coverage detected