Skip to content

Commit 4bc6483

Browse files
authored
Merge pull request #6034 from radarhere/imageops
2 parents a6efaa1 + ecb64fe commit 4bc6483

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

Tests/test_imageops.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ def test_sanity():
6363
ImageOps.grayscale(hopper("L"))
6464
ImageOps.grayscale(hopper("RGB"))
6565

66+
ImageOps.invert(hopper("1"))
6667
ImageOps.invert(hopper("L"))
6768
ImageOps.invert(hopper("RGB"))
6869

src/PIL/ImageOps.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -525,7 +525,7 @@ def invert(image):
525525
lut = []
526526
for i in range(256):
527527
lut.append(255 - i)
528-
return _lut(image, lut)
528+
return image.point(lut) if image.mode == "1" else _lut(image, lut)
529529

530530

531531
def mirror(image):

0 commit comments

Comments
 (0)