mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-12-27 10:26:19 +03:00
Allow 1 mode images to be inverted
This commit is contained in:
parent
f018518e24
commit
ecb64fe210
|
@ -63,6 +63,7 @@ def test_sanity():
|
||||||
ImageOps.grayscale(hopper("L"))
|
ImageOps.grayscale(hopper("L"))
|
||||||
ImageOps.grayscale(hopper("RGB"))
|
ImageOps.grayscale(hopper("RGB"))
|
||||||
|
|
||||||
|
ImageOps.invert(hopper("1"))
|
||||||
ImageOps.invert(hopper("L"))
|
ImageOps.invert(hopper("L"))
|
||||||
ImageOps.invert(hopper("RGB"))
|
ImageOps.invert(hopper("RGB"))
|
||||||
|
|
||||||
|
|
|
@ -523,7 +523,7 @@ def invert(image):
|
||||||
lut = []
|
lut = []
|
||||||
for i in range(256):
|
for i in range(256):
|
||||||
lut.append(255 - i)
|
lut.append(255 - i)
|
||||||
return _lut(image, lut)
|
return image.point(lut) if image.mode == "1" else _lut(image, lut)
|
||||||
|
|
||||||
|
|
||||||
def mirror(image):
|
def mirror(image):
|
||||||
|
|
Loading…
Reference in New Issue
Block a user