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

Method _detect_endian

src/docx/image/tiff.py:81–86  ·  view source on GitHub ↗

Return either BIG_ENDIAN or LITTLE_ENDIAN depending on the endian indicator found in the TIFF `stream` header, either 'MM' or 'II'.

(cls, stream)

Source from the content-addressed store, hash-verified

79
80 @classmethod
81 def _detect_endian(cls, stream):
82 """Return either BIG_ENDIAN or LITTLE_ENDIAN depending on the endian indicator
83 found in the TIFF `stream` header, either 'MM' or 'II'."""
84 stream.seek(0)
85 endian_str = stream.read(2)
86 return BIG_ENDIAN if endian_str == b"MM" else LITTLE_ENDIAN
87
88 def _dpi(self, resolution_tag):
89 """Return the dpi value calculated for `resolution_tag`, which can be either

Callers 1

_make_stream_readerMethod · 0.80

Calls 2

seekMethod · 0.80
readMethod · 0.80

Tested by

no test coverage detected