From 1f182ce8da03b375986c6bdf78f1337e3872bd0b Mon Sep 17 00:00:00 2001 From: scaramallion Date: Mon, 25 Mar 2024 17:39:21 +1100 Subject: [PATCH] Fix parsing the J2K header --- src/PIL/Jpeg2KImagePlugin.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/PIL/Jpeg2KImagePlugin.py b/src/PIL/Jpeg2KImagePlugin.py index 925a9148c..d5734feac 100644 --- a/src/PIL/Jpeg2KImagePlugin.py +++ b/src/PIL/Jpeg2KImagePlugin.py @@ -110,11 +110,11 @@ def _parse_codestream(fp): xrsiz = [None] * csiz yrsiz = [None] * csiz for i in range(csiz): - ssiz[i], xrsiz[i], yrsiz[i] = struct.unpack_from(">BBB", siz, 36 + 3 * i) + ssiz[i], xrsiz[i], yrsiz[i] = struct.unpack_from(">BBB", siz, 38 + 3 * i) size = (xsiz - xosiz, ysiz - yosiz) if csiz == 1: - if (yrsiz[0] & 0x7F) + 1 > 8: + if (ssiz[0] & 0x7F) + 1 > 8: mode = "I;16" else: mode = "L"