MCPcopy Index your code
hub / github.com/python-openxml/python-docx / from_stream

Method from_stream

src/docx/image/png.py:22–32  ·  view source on GitHub ↗

Return a |Png| instance having header properties parsed from image in `stream`.

(cls, stream)

Source from the content-addressed store, hash-verified

20
21 @classmethod
22 def from_stream(cls, stream):
23 """Return a |Png| instance having header properties parsed from image in
24 `stream`."""
25 parser = _PngParser.parse(stream)
26
27 px_width = parser.px_width
28 px_height = parser.px_height
29 horz_dpi = parser.horz_dpi
30 vert_dpi = parser.vert_dpi
31
32 return cls(px_width, px_height, horz_dpi, vert_dpi)
33
34
35class _PngParser:

Calls 1

parseMethod · 0.45