From 7844c6e48354bb9c7e4e029a394376ce21a76eff Mon Sep 17 00:00:00 2001 From: Andrew Murray Date: Mon, 29 Mar 2021 23:26:34 +1100 Subject: [PATCH] Test that preserve_tone changes RGB images but not L images --- Tests/test_imageops.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Tests/test_imageops.py b/Tests/test_imageops.py index 888afad37..93be34bf8 100644 --- a/Tests/test_imageops.py +++ b/Tests/test_imageops.py @@ -365,6 +365,15 @@ def test_autocontrast_mask_real_input(): ) +def test_autocontrast_preserve_tone(): + def autocontrast(mode, preserve_tone): + im = hopper(mode) + return ImageOps.autocontrast(im, preserve_tone=preserve_tone).histogram() + + assert autocontrast("RGB", True) != autocontrast("RGB", False) + assert autocontrast("L", True) == autocontrast("L", False) + + def test_autocontrast_preserve_gradient(): gradient = Image.linear_gradient("L")