Skip to content

Commit

Permalink
Merge pull request #7490 from Yay295/patch-1
Browse files Browse the repository at this point in the history
Add mode to ImageOps._lut() error message
  • Loading branch information
hugovk authored Oct 27, 2023
2 parents 57c72b6 + 5295df3 commit d3fd173
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 6 additions & 0 deletions Tests/test_imageops.py
Original file line number Diff line number Diff line change
Expand Up @@ -433,6 +433,12 @@ def test_exif_transpose_in_place():
assert_image_equal(im, expected)


def test_autocontrast_unsupported_mode():
im = Image.new("RGBA", (1, 1))
with pytest.raises(OSError):
ImageOps.autocontrast(im)


def test_autocontrast_cutoff():
# Test the cutoff argument of autocontrast
with Image.open("Tests/images/bw_gradient.png") as img:
Expand Down
2 changes: 1 addition & 1 deletion src/PIL/ImageOps.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def _lut(image, lut):
lut = lut + lut + lut
return image.point(lut)
else:
msg = "not supported for this image mode"
msg = f"not supported for mode {image.mode}"
raise OSError(msg)


Expand Down

0 comments on commit d3fd173

Please sign in to comment.