mirror of
https://github.com/TheAlgorithms/Python.git
synced 2024-11-23 21:11:08 +00:00
parent
9b3f7c36d0
commit
5903948cf3
|
@ -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)
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user