Restore numpy.array as valid lookup tables

This commit is contained in:
wiredfool 2013-12-10 15:47:26 -08:00
parent 404b245d89
commit d05b5d9060
2 changed files with 13 additions and 1 deletions

View File

@ -1150,7 +1150,7 @@ class Image:
if isinstance(lut, ImagePointHandler):
return lut.point(self)
if not isinstance(lut, collections.Sequence):
if callable(lut):
# if it isn't a list, it should be a function
if self.mode in ("I", "I;16", "F"):
# check if the function can be used with point_transform

View File

@ -106,3 +106,15 @@ def test_to_array():
for mode in modes:
assert_no_exception(lambda: _to_array(*mode))
def test_point_lut():
# see https://github.com/python-imaging/Pillow/issues/439
data = list(range(256))*3
lut = numpy.array(data, dtype='uint8')
im = lena()
assert_no_exception(lambda: im.point(lut))