

from PIL import Image





def 					lowercase_ (    __snake_case     :							Image	,	__snake_case     :							int      )     -> Image:





				'''simple docstring'''


				snake_case__      :int         =   (2_59 * (level + 2_55)) / (2_55 * (2_59 - level))

				def contrast(__snake_case     :							int      ) -> int:
								return int(1_28 + factor * (c - 1_28)      )

				return img.point(__snake_case      )


if __name__ == "__main__":
	# Load image
	with Image.open("image_data/lena.jpg") as img:
		# Change contrast to 170
		__UpperCAmelCase							:   Dict							=  change_contrast(img, 1_7_0)
		cont_img.save("image_data/lena_high_contrast.png", format="png")







from ...utils import (
    OptionalDependencyNotAvailable,
    is_flax_available,
    is_torch_available,
    is_transformers_available,
)


try:
	if not (is_transformers_available() and is_torch_available()):
		raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
	from ...utils.dummy_torch_and_transformers_objects import *  # noqa F403
else:
	from .multicontrolnet import MultiControlNetModel
	from .pipeline_controlnet import StableDiffusionControlNetPipeline
	from .pipeline_controlnet_imgaimg import StableDiffusionControlNetImgaImgPipeline
	from .pipeline_controlnet_inpaint import StableDiffusionControlNetInpaintPipeline


if is_transformers_available() and is_flax_available():
	from .pipeline_flax_controlnet import FlaxStableDiffusionControlNetPipeline