Skip to main content

Posts

Showing posts with the label changing brightness and contrast using tkinter

Image Editing Software | Changing Brightness And Contrast

 Hello! In this post, you will be learning how to change the brightness and contrast of an image using the PIL library package. You can check out the video below to learn more.  We will continue to build out previous code. Let us start by importing the required library package. from PIL import ImageEnhance The ImageEnhance package will be used to change the brightness and contrast of an image. Now, we will be writing a few lines to the brightness_callback() method.  def brightness_callback (brightness_pos): brightness_pos = float (brightness_pos) global outputImage enhancer = ImageEnhance.Brightness(originalImage) outputImage = enhancer.enhance(brightness_pos) dispayImage(outputImage) brightness_callback() method requires an argument to be passed. This argument holds the current position of the slider and is of string type. The ImageEnhance library package needs a variable of float type. So that is why in the first line we have converted the brightne...