Skip to content

Commit

Permalink
marker
Browse files Browse the repository at this point in the history
  • Loading branch information
radarhere committed Dec 25, 2024
1 parent 92388bd commit b6dfe28
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/PIL/Jpeg2KImagePlugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit b6dfe28

Please sign in to comment.