Skip to content

Commit

Permalink
Round lut values to integer
Browse files Browse the repository at this point in the history
  • Loading branch information
radarhere committed Apr 6, 2022
1 parent 4996f84 commit 4f95938
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions Tests/test_image_point.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
2 changes: 2 additions & 0 deletions src/PIL/Image.py
Original file line number Diff line number Diff line change
Expand Up @@ -1720,6 +1720,8 @@ def point(self, data):
# FIXME: _imaging returns a confusing error message for this case
raise ValueError("point operation not supported for this mode")

if mode != "F":
lut = [int(i) for i in lut]
return self._new(self.im.point(lut, mode))

def putalpha(self, alpha):
Expand Down

0 comments on commit 4f95938

Please sign in to comment.