Skip to content

Commit

Permalink
Merge pull request #6034 from radarhere/imageops
Browse files Browse the repository at this point in the history
  • Loading branch information
hugovk committed Mar 30, 2022
2 parents a6efaa1 + ecb64fe commit 4bc6483
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions Tests/test_imageops.py
Expand Up @@ -63,6 +63,7 @@ def test_sanity():
ImageOps.grayscale(hopper("L"))
ImageOps.grayscale(hopper("RGB"))

ImageOps.invert(hopper("1"))
ImageOps.invert(hopper("L"))
ImageOps.invert(hopper("RGB"))

Expand Down
2 changes: 1 addition & 1 deletion src/PIL/ImageOps.py
Expand Up @@ -525,7 +525,7 @@ def invert(image):
lut = []
for i in range(256):
lut.append(255 - i)
return _lut(image, lut)
return image.point(lut) if image.mode == "1" else _lut(image, lut)


def mirror(image):
Expand Down

0 comments on commit 4bc6483

Please sign in to comment.