From a098c88509f74e80febd6332f4c0dc88ac4c1a76 Mon Sep 17 00:00:00 2001 From: wiredfool Date: Thu, 14 Jan 2016 08:58:13 -0800 Subject: [PATCH] Convert was passing in a 3tuple to putpixel for a P image --- PIL/Image.py | 6 ++++++ 1 file changed, 6 insertions(+) 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'):