Round lut values where necessary

This commit is contained in:
Andrew Murray 2022-04-07 08:58:57 +10:00
parent 4996f84fb3
commit 42f67d184a
2 changed files with 3 additions and 0 deletions

View File

@ -10,6 +10,7 @@ def test_sanity():
im.point(list(range(256)))
im.point(list(range(256)) * 3)
im.point(lambda x: x)
im.point(lambda x: x * 1.2)
im = im.convert("I")
with pytest.raises(ValueError):

View File

@ -1720,6 +1720,8 @@ class Image:
# FIXME: _imaging returns a confusing error message for this case
raise ValueError("point operation not supported for this mode")
if mode != "F":
lut = [round(i) for i in lut]
return self._new(self.im.point(lut, mode))
def putalpha(self, alpha):