From 0f49eaf23041e7b27c3a7b8d3b62433b2178fa08 Mon Sep 17 00:00:00 2001 From: Andrew Murray Date: Mon, 25 Mar 2024 18:23:52 +1100 Subject: [PATCH] Simplified code --- src/PIL/Jpeg2KImagePlugin.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/PIL/Jpeg2KImagePlugin.py b/src/PIL/Jpeg2KImagePlugin.py index d5734feac..be000c351 100644 --- a/src/PIL/Jpeg2KImagePlugin.py +++ b/src/PIL/Jpeg2KImagePlugin.py @@ -106,14 +106,10 @@ def _parse_codestream(fp): lsiz, rsiz, xsiz, ysiz, xosiz, yosiz, _, _, _, _, csiz = struct.unpack_from( ">HHIIIIIIIIH", siz ) - ssiz = [None] * csiz - xrsiz = [None] * csiz - yrsiz = [None] * csiz - for i in range(csiz): - ssiz[i], xrsiz[i], yrsiz[i] = struct.unpack_from(">BBB", siz, 38 + 3 * i) size = (xsiz - xosiz, ysiz - yosiz) if csiz == 1: + ssiz = struct.unpack_from(">B", siz, 38) if (ssiz[0] & 0x7F) + 1 > 8: mode = "I;16" else: