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

Function _pngxy

IPython/core/display.py:1065–1069  ·  view source on GitHub ↗

read the (width, height) from a PNG header

(data)

Source from the content-addressed store, hash-verified

1063_JPEG = b'\xff\xd8'
1064
1065def _pngxy(data):
1066 """read the (width, height) from a PNG header"""
1067 ihdr = data.index(b'IHDR')
1068 # next 8 bytes are width/height
1069 return struct.unpack('>ii', data[ihdr+4:ihdr+12])
1070
1071def _jpegxy(data):
1072 """read the (width, height) from a JPEG header"""

Callers 2

retina_figureFunction · 0.90
_retina_shapeMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected