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

Method from_stream

src/docx/image/jpeg.py:316–333  ·  view source on GitHub ↗

Return an |_App0Marker| instance for the APP0 marker at `offset` in `stream`.

(cls, stream, marker_code, offset)

Source from the content-addressed store, hash-verified

314
315 @classmethod
316 def from_stream(cls, stream, marker_code, offset):
317 """Return an |_App0Marker| instance for the APP0 marker at `offset` in
318 `stream`."""
319 # field off type notes
320 # ------------------ --- ----- -------------------
321 # segment length 0 short
322 # JFIF identifier 2 5 chr 'JFIF\x00'
323 # major JPEG version 7 byte typically 1
324 # minor JPEG version 8 byte typically 1 or 2
325 # density units 9 byte 1=inches, 2=cm
326 # horz dots per unit 10 short
327 # vert dots per unit 12 short
328 # ------------------ --- ----- -------------------
329 segment_length = stream.read_short(offset)
330 density_units = stream.read_byte(offset, 9)
331 x_density = stream.read_short(offset, 10)
332 y_density = stream.read_short(offset, 12)
333 return cls(marker_code, offset, segment_length, density_units, x_density, y_density)
334
335
336class _App1Marker(_Marker):

Callers

nothing calls this directly

Calls 2

read_shortMethod · 0.80
read_byteMethod · 0.80

Tested by

no test coverage detected