Skip to content

Commit

Permalink
Do not reduce size if tile already loaded
Browse files Browse the repository at this point in the history
Co-Authored-By: Alexander Karpinsky <homm86@gmail.com>
  • Loading branch information
radarhere and homm committed Mar 24, 2020
1 parent 61885f3 commit afa7e02
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/PIL/Jpeg2KImagePlugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,15 +216,14 @@ 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 = (
int((self.size[0] + adjust) / power),
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])
Expand Down

0 comments on commit afa7e02

Please sign in to comment.