Skip to content

Commit

Permalink
Create maxval variable
Browse files Browse the repository at this point in the history
  • Loading branch information
Piolie committed Jan 31, 2021
1 parent 50522d9 commit 39288f0
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/PIL/PpmImagePlugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,8 @@ def _open(self):
if mode == "1":
break
elif ix == 2: # token is maxval
if token > 255:
maxval = token
if maxval > 255:
if not mode == "L":
raise ValueError(f"Too many colors for band: {token}")
if token < 2 ** 16:
Expand Down

0 comments on commit 39288f0

Please sign in to comment.