mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-01-15 03:46:28 +03:00
commit
55e70da265
|
@ -399,7 +399,7 @@ def _fixup_dict(src_dict):
|
||||||
# returns a dict with any single item tuples/lists as individual values
|
# returns a dict with any single item tuples/lists as individual values
|
||||||
def _fixup(value):
|
def _fixup(value):
|
||||||
try:
|
try:
|
||||||
if len(value) == 1 and type(value) != type({}):
|
if len(value) == 1 and not isinstance(value, dict):
|
||||||
return value[0]
|
return value[0]
|
||||||
except: pass
|
except: pass
|
||||||
return value
|
return value
|
||||||
|
|
|
@ -1119,18 +1119,19 @@ class TiffImageFile(ImageFile.ImageFile):
|
||||||
if DEBUG:
|
if DEBUG:
|
||||||
print("- size:", self.size)
|
print("- size:", self.size)
|
||||||
|
|
||||||
format = self.tag_v2.get(SAMPLEFORMAT, (1,))
|
sampleFormat = self.tag_v2.get(SAMPLEFORMAT, (1,))
|
||||||
if len(format) > 1 and max(format) == min(format) == 1:
|
if (len(sampleFormat) > 1
|
||||||
|
and max(sampleFormat) == min(sampleFormat) == 1):
|
||||||
# SAMPLEFORMAT is properly per band, so an RGB image will
|
# SAMPLEFORMAT is properly per band, so an RGB image will
|
||||||
# be (1,1,1). But, we don't support per band pixel types,
|
# be (1,1,1). But, we don't support per band pixel types,
|
||||||
# and anything more than one band is a uint8. So, just
|
# and anything more than one band is a uint8. So, just
|
||||||
# take the first element. Revisit this if adding support
|
# take the first element. Revisit this if adding support
|
||||||
# for more exotic images.
|
# for more exotic images.
|
||||||
format = (1,)
|
sampleFormat = (1,)
|
||||||
|
|
||||||
# mode: check photometric interpretation and bits per pixel
|
# mode: check photometric interpretation and bits per pixel
|
||||||
key = (
|
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(BITSPERSAMPLE, (1,)),
|
||||||
self.tag_v2.get(EXTRASAMPLES, ())
|
self.tag_v2.get(EXTRASAMPLES, ())
|
||||||
)
|
)
|
||||||
|
@ -1215,7 +1216,7 @@ class TiffImageFile(ImageFile.ImageFile):
|
||||||
# https://github.com/python-pillow/Pillow/issues/279
|
# https://github.com/python-pillow/Pillow/issues/279
|
||||||
if fillorder == 2:
|
if fillorder == 2:
|
||||||
key = (
|
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(BITSPERSAMPLE, (1,)),
|
||||||
self.tag_v2.get(EXTRASAMPLES, ())
|
self.tag_v2.get(EXTRASAMPLES, ())
|
||||||
)
|
)
|
||||||
|
|
|
@ -39,7 +39,7 @@ class Enhance(Frame):
|
||||||
s.pack()
|
s.pack()
|
||||||
|
|
||||||
def update(self, value):
|
def update(self, value):
|
||||||
self.value = eval(value)
|
self.value = float(value)
|
||||||
self.tkim.paste(self.enhancer.enhance(self.value))
|
self.tkim.paste(self.enhancer.enhance(self.value))
|
||||||
|
|
||||||
#
|
#
|
||||||
|
|
|
@ -208,9 +208,9 @@ class PILDriver(object):
|
||||||
Process the top image with the given filter.
|
Process the top image with the given filter.
|
||||||
"""
|
"""
|
||||||
from PIL import ImageFilter
|
from PIL import ImageFilter
|
||||||
filter = eval("ImageFilter." + self.do_pop().upper())
|
imageFilter = getattr(ImageFilter, self.do_pop().upper())
|
||||||
image = self.do_pop()
|
image = self.do_pop()
|
||||||
self.push(image.filter(filter))
|
self.push(image.filter(imageFilter))
|
||||||
|
|
||||||
def do_getbbox(self):
|
def do_getbbox(self):
|
||||||
"""usage: getbbox
|
"""usage: getbbox
|
||||||
|
|
|
@ -42,7 +42,7 @@ class UI(Frame):
|
||||||
# self.redraw()
|
# self.redraw()
|
||||||
|
|
||||||
def update_scale(self, value):
|
def update_scale(self, value):
|
||||||
self.value = eval(value)
|
self.value = float(value)
|
||||||
|
|
||||||
self.redraw()
|
self.redraw()
|
||||||
|
|
||||||
|
|
|
@ -251,8 +251,8 @@ class TestFileTiff(PillowTestCase):
|
||||||
filename = "Tests/images/pil136.tiff"
|
filename = "Tests/images/pil136.tiff"
|
||||||
im = Image.open(filename)
|
im = Image.open(filename)
|
||||||
|
|
||||||
self.assert_warning(DeprecationWarning, lambda: im.tag_v2.as_dict())
|
self.assert_warning(DeprecationWarning, im.tag_v2.as_dict)
|
||||||
self.assert_warning(DeprecationWarning, lambda: im.tag.as_dict())
|
self.assert_warning(DeprecationWarning, im.tag.as_dict)
|
||||||
|
|
||||||
def test_dict(self):
|
def test_dict(self):
|
||||||
# Arrange
|
# Arrange
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
import nose
|
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
import glob
|
import glob
|
||||||
|
|
Loading…
Reference in New Issue
Block a user