Skip to content

Commit

Permalink
Support 1 mode images in several methods
Browse files Browse the repository at this point in the history
  • Loading branch information
radarhere committed Feb 7, 2022
1 parent f018518 commit bb4ce0b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions Tests/test_imageops.py
Expand Up @@ -22,6 +22,7 @@ def getmesh(self, im):

def test_sanity():

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

Expand All @@ -46,6 +47,7 @@ def test_sanity():
ImageOps.deform(hopper("L"), deformer)
ImageOps.deform(hopper("RGB"), deformer)

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

Expand All @@ -63,15 +65,18 @@ def test_sanity():
ImageOps.grayscale(hopper("L"))
ImageOps.grayscale(hopper("RGB"))

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

ImageOps.mirror(hopper("L"))
ImageOps.mirror(hopper("RGB"))

ImageOps.posterize(hopper("1"), 4)
ImageOps.posterize(hopper("L"), 4)
ImageOps.posterize(hopper("RGB"), 4)

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

Expand Down
2 changes: 1 addition & 1 deletion src/PIL/ImageOps.py
Expand Up @@ -50,7 +50,7 @@ def _lut(image, lut):
if image.mode == "P":
# FIXME: apply to lookup table, not image data
raise NotImplementedError("mode P support coming soon")
elif image.mode in ("L", "RGB"):
elif image.mode in ("1", "L", "RGB"):
if image.mode == "RGB" and len(lut) == 256:
lut = lut + lut + lut
return image.point(lut)
Expand Down

0 comments on commit bb4ce0b

Please sign in to comment.