From afa7e024cade7662337d0721f01ee26161983486 Mon Sep 17 00:00:00 2001 From: Andrew Murray <3112309+radarhere@users.noreply.github.com> Date: Fri, 20 Mar 2020 18:14:08 +1100 Subject: [PATCH] Do not reduce size if tile already loaded Co-Authored-By: Alexander Karpinsky --- src/PIL/Jpeg2KImagePlugin.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/PIL/Jpeg2KImagePlugin.py b/src/PIL/Jpeg2KImagePlugin.py index 2dab7808f2f..0b0d433db41 100644 --- a/src/PIL/Jpeg2KImagePlugin.py +++ b/src/PIL/Jpeg2KImagePlugin.py @@ -216,7 +216,7 @@ def reduce(self, value): self._reduce = value def load(self): - if self._reduce: + if self.tile and self._reduce: power = 1 << self._reduce adjust = power >> 1 self._size = ( @@ -224,7 +224,6 @@ def load(self): int((self.size[1] + adjust) / power), ) - if self.tile: # Update the reduce and layers settings t = self.tile[0] t3 = (t[3][0], self._reduce, self.layers, t[3][3], t[3][4])