mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-02-04 21:50:54 +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):
|
if isinstance(lut, ImagePointHandler):
|
||||||
return lut.point(self)
|
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 it isn't a list, it should be a function
|
||||||
if self.mode in ("I", "I;16", "F"):
|
if self.mode in ("I", "I;16", "F"):
|
||||||
# check if the function can be used with point_transform
|
# check if the function can be used with point_transform
|
||||||
|
|
|
@ -106,3 +106,15 @@ def test_to_array():
|
||||||
for mode in modes:
|
for mode in modes:
|
||||||
assert_no_exception(lambda: _to_array(*mode))
|
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