What did you do?
from PIL import Image, ImageOps
img: Image.Image = Image.open("in.png")
img = ImageOps.autocontrast(img, (5, 45))
img = img.convert('1', dither=Image.Dither.NONE)
img.save("out.png")
in.png:
What did you expect to happen?
mypy would validate the above code snippet as containing no typing errors—the documentation for ImageOps.autocontrast says that cutoff can be a number or a tuple of length 2.
What actually happened?
error: Argument 2 to "autocontrast" has incompatible type "tuple[int, int]"; expected "int" [arg-type]
What are your OS, Python and Pillow versions?
- OS: Windows 10 version 22H2 (OS Build 19045.3930)
- Python: 3.10.11
- Pillow: 10.2.0