From 5903948cf3806b6faea2962874c5130780edd324 Mon Sep 17 00:00:00 2001 From: Dmytro Litvinov Date: Sat, 3 Oct 2020 10:22:22 +0300 Subject: [PATCH] Fixes: #2404. Fix PIL DeprecationWarnings in pytest output (#2678) --- 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 c7da52298..6a1504002 100644 --- a/digital_image_processing/change_contrast.py +++ b/digital_image_processing/change_contrast.py @@ -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)