Merge pull request #7490 from Yay295/patch-1

Add mode to ImageOps._lut() error message
This commit is contained in:
Hugo van Kemenade 2023-10-27 07:40:44 +03:00 committed by GitHub
commit d3fd1734af
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 1 deletions

View File

@ -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:

View File

@ -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)