From b6dfe288362b733b7a1c35eacb128a697ec79777 Mon Sep 17 00:00:00 2001 From: Andrew Murray Date: Thu, 26 Dec 2024 00:10:53 +1100 Subject: [PATCH] marker --- src/PIL/Jpeg2KImagePlugin.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/PIL/Jpeg2KImagePlugin.py b/src/PIL/Jpeg2KImagePlugin.py index 93b1ee32d03..e1ffcc4f61c 100644 --- a/src/PIL/Jpeg2KImagePlugin.py +++ b/src/PIL/Jpeg2KImagePlugin.py @@ -252,6 +252,7 @@ def _open(self) -> None: if sig == b"\xff\x4f\xff\x51": self.codec = "j2k" self._size, self._mode = _parse_codestream(self.fp) + self._parse_comment() else: sig = sig + self.fp.read(8) @@ -301,12 +302,15 @@ def _open(self) -> None: def _parse_comment(self) -> None: hdr = self.fp.read(2) length = _binary.i16be(hdr) + print("hdr", hdr, "marker length", length) self.fp.seek(length - 2, os.SEEK_CUR) while True: marker = self.fp.read(2) if not marker: + print("nomarker") break + print("marker", marker) typ = marker[1] if typ in (0x90, 0xD9): # Start of tile or end of codestream