mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-01-26 09:14:27 +03:00
Update src/PIL/ImageOps.py
Yup you are absolutely correct; it does the job in fewer lines of code too. Co-authored-by: Andrew Murray <3112309+radarhere@users.noreply.github.com>
This commit is contained in:
parent
16e804b892
commit
27c40910d8
|
@ -88,12 +88,8 @@ def autocontrast(image, cutoff=0, ignore=None):
|
|||
h[ix] = 0
|
||||
if cutoff:
|
||||
# cut off pixels from both ends of the histogram
|
||||
if isinstance(cutoff, int):
|
||||
if not isinstance(cutoff, tuple):
|
||||
cutoff = (cutoff, cutoff)
|
||||
elif isinstance(cutoff, tuple):
|
||||
pass
|
||||
else:
|
||||
raise ValueError("the cutoff can only be a integer or tuple")
|
||||
# get number of pixels
|
||||
n = 0
|
||||
for ix in range(256):
|
||||
|
|
Loading…
Reference in New Issue
Block a user