diff --git a/PIL/Image.py b/PIL/Image.py index 89549ea4a..c3f778f88 100644 --- a/PIL/Image.py +++ b/PIL/Image.py @@ -875,6 +875,12 @@ class Image(object): trns_im = Image()._new(core.new(self.mode, (1, 1))) if self.mode == 'P': 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) if mode in ('L', 'RGB'):