mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-12-27 18:36:17 +03:00
mypy fixes after merge
This commit is contained in:
parent
31a8da48ee
commit
2a2033eea1
|
@ -1128,7 +1128,10 @@ class Image:
|
||||||
del new_im.info["transparency"]
|
del new_im.info["transparency"]
|
||||||
if trns is not None:
|
if trns is not None:
|
||||||
try:
|
try:
|
||||||
new_im.info["transparency"] = new_im.palette.getcolor(trns, new_im)
|
new_im.info["transparency"] = new_im.palette.getcolor(
|
||||||
|
cast(Tuple[int, int, int], trns), # trns was converted to RGB
|
||||||
|
new_im,
|
||||||
|
)
|
||||||
except Exception:
|
except Exception:
|
||||||
# if we can't make a transparent color, don't leave the old
|
# if we can't make a transparent color, don't leave the old
|
||||||
# transparency hanging around to mess us up.
|
# transparency hanging around to mess us up.
|
||||||
|
@ -1178,7 +1181,10 @@ class Image:
|
||||||
if trns is not None:
|
if trns is not None:
|
||||||
if new_im.mode == "P":
|
if new_im.mode == "P":
|
||||||
try:
|
try:
|
||||||
new_im.info["transparency"] = new_im.palette.getcolor(trns, new_im)
|
new_im.info["transparency"] = new_im.palette.getcolor(
|
||||||
|
cast(Tuple[int, int, int], trns), # trns was converted to RGB
|
||||||
|
new_im,
|
||||||
|
)
|
||||||
except ValueError as e:
|
except ValueError as e:
|
||||||
del new_im.info["transparency"]
|
del new_im.info["transparency"]
|
||||||
if str(e) != "cannot allocate more than 256 colors":
|
if str(e) != "cannot allocate more than 256 colors":
|
||||||
|
|
Loading…
Reference in New Issue
Block a user