From 2064566de0cca11491aa4d76cd411902a8ceee4e Mon Sep 17 00:00:00 2001 From: Dmytro Litvinov Date: Sat, 3 Oct 2020 09:37:16 +0300 Subject: [PATCH] Fixes: #2404. Fix PIL DeprecationWarnings in pytest output --- digital_image_processing/change_contrast.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/digital_image_processing/change_contrast.py b/digital_image_processing/change_contrast.py index c7da52298ae2..6a150400249f 100644 --- a/digital_image_processing/change_contrast.py +++ b/digital_image_processing/change_contrast.py @@ -11,18 +11,18 @@ 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)