Create maxval variable

This commit is contained in:
Piolie 2021-01-31 00:51:39 -03:00
parent 50522d932e
commit 39288f0fb0

View File

@ -125,7 +125,8 @@ class PpmImageFile(ImageFile.ImageFile):
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: