diff --git a/PIL/TiffImagePlugin.py b/PIL/TiffImagePlugin.py index 99beb0f97..ad6939c26 100644 --- a/PIL/TiffImagePlugin.py +++ b/PIL/TiffImagePlugin.py @@ -1119,18 +1119,19 @@ class TiffImageFile(ImageFile.ImageFile): if DEBUG: print("- size:", self.size) - format = self.tag_v2.get(SAMPLEFORMAT, (1,)) - if len(format) > 1 and max(format) == min(format) == 1: + sampleFormat = self.tag_v2.get(SAMPLEFORMAT, (1,)) + if (len(sampleFormat) > 1 + and max(sampleFormat) == min(sampleFormat) == 1): # SAMPLEFORMAT is properly per band, so an RGB image will # be (1,1,1). But, we don't support per band pixel types, # and anything more than one band is a uint8. So, just # take the first element. Revisit this if adding support # for more exotic images. - format = (1,) + sampleFormat = (1,) # mode: check photometric interpretation and bits per pixel key = ( - self.tag_v2.prefix, photo, format, fillorder, + self.tag_v2.prefix, photo, sampleFormat, fillorder, self.tag_v2.get(BITSPERSAMPLE, (1,)), self.tag_v2.get(EXTRASAMPLES, ()) ) @@ -1215,7 +1216,7 @@ class TiffImageFile(ImageFile.ImageFile): # https://github.com/python-pillow/Pillow/issues/279 if fillorder == 2: key = ( - self.tag_v2.prefix, photo, format, 1, + self.tag_v2.prefix, photo, sampleFormat, 1, self.tag_v2.get(BITSPERSAMPLE, (1,)), self.tag_v2.get(EXTRASAMPLES, ()) ) diff --git a/Scripts/pildriver.py b/Scripts/pildriver.py index 0ede74db5..318584ad1 100644 --- a/Scripts/pildriver.py +++ b/Scripts/pildriver.py @@ -208,9 +208,9 @@ class PILDriver(object): Process the top image with the given filter. """ from PIL import ImageFilter - filter = eval("ImageFilter." + self.do_pop().upper()) + imageFilter = eval("ImageFilter." + self.do_pop().upper()) image = self.do_pop() - self.push(image.filter(filter)) + self.push(image.filter(imageFilter)) def do_getbbox(self): """usage: getbbox