diff --git a/PIL/Image.py b/PIL/Image.py index cf5c4f477..43748ee76 100644 --- a/PIL/Image.py +++ b/PIL/Image.py @@ -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 diff --git a/Tests/test_numpy.py b/Tests/test_numpy.py index 61b3cf480..85596047b 100644 --- a/Tests/test_numpy.py +++ b/Tests/test_numpy.py @@ -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)) + +