mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-01-26 17:24:31 +03:00
Restore numpy.array as valid lookup tables
This commit is contained in:
parent
404b245d89
commit
d05b5d9060
|
@ -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
|
||||
|
|
|
@ -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))
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user