Fixes: #2404. Fix PIL DeprecationWarnings in pytest output (#2678)

This commit is contained in:
Dmytro Litvinov 2020-10-03 10:22:22 +03:00 committed by GitHub
parent 9b3f7c36d0
commit 5903948cf3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -11,18 +11,18 @@ flake8 : True
from PIL import Image
def change_contrast(img: Image, level: float) -> Image:
def change_contrast(img: Image, level: int) -> Image:
"""
Function to change contrast
"""
factor = (259 * (level + 255)) / (255 * (259 - level))
def contrast(c: int) -> float:
def contrast(c: int) -> int:
"""
Fundamental Transformation/Operation that'll be performed on
every bit.
"""
return 128 + factor * (c - 128)
return int(128 + factor * (c - 128))
return img.point(contrast)