mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-05-03 15:33:41 +03:00
Convert was passing in a 3tuple to putpixel for a P image
This commit is contained in:
parent
5ff9f24fcc
commit
a098c88509
|
@ -875,6 +875,12 @@ class Image(object):
|
||||||
trns_im = Image()._new(core.new(self.mode, (1, 1)))
|
trns_im = Image()._new(core.new(self.mode, (1, 1)))
|
||||||
if self.mode == 'P':
|
if self.mode == 'P':
|
||||||
trns_im.putpalette(self.palette)
|
trns_im.putpalette(self.palette)
|
||||||
|
if type(t) == tuple:
|
||||||
|
try:
|
||||||
|
t = trns_im.palette.getcolor(t)
|
||||||
|
except:
|
||||||
|
raise ValueError("Couldn't allocate a palette "+
|
||||||
|
"color for transparency")
|
||||||
trns_im.putpixel((0, 0), t)
|
trns_im.putpixel((0, 0), t)
|
||||||
|
|
||||||
if mode in ('L', 'RGB'):
|
if mode in ('L', 'RGB'):
|
||||||
|
|
Loading…
Reference in New Issue
Block a user