Python PIL | ImageEnhance.Brightness() and ImageEnhance.Sharpness() method
PIL is the Python Imaging Library which provides the python interpreter with image editing capabilities. The ImageEnhance module contains a number of classes that can be used for image enhancement.
ImageEnhance.Brightness() method –
This class can be used to control the brightness of an image. An enhancement factor of 0.0 gives a black image. A factor of 1.0 gives the original image.
Syntax:
obj = ImageEnhance.Brightness(image) obj.enhance(factor)
First, it is required to create an object of corresponding class in order to enhance image.
# This will import Image and ImageEnhance modules from PIL import Image, ImageEnhance # Opening Image im = Image.open(r"C:\Users\Admin\Pictures\images.png") # Creating object of Brightness class im3 = ImageEnhance.Brightness(im) # showing resultant image im3.enhance(2.0).show() |
Output:
For first image factor is 2.0 and for second 5.0


ImageEnhance.Sharpness() method –
This class can be used to adjust the sharpness of an image. An enhancement factor of 0.0 gives a blurred image, a factor of 1.0 gives the original image, and a factor of 2.0 gives a sharpened image.
Syntax:
obj = ImageEnhance.Sharpness(image) obj.enhance(factor)
First, it is required to create an object of corresponding class in order to enhance image.
# This will import Image and ImageChops modules from PIL import Image, ImageEnhance # Opening Image im = Image.open(r"C:\Users\Admin\Pictures\images.png") # Creating object of Sharpness class im3 = ImageEnhance.Sharpness(im) # showing resultant image im3.enhance(-2.0).show() |
Output:
For first image factor is -2.0 and for second image it is 5.0


Recommended Posts:
- class method vs static method in Python
- Python | next() method
- Python | set() method
- Python | os.dup() method
- Python | after method in Tkinter
- Python | Tensorflow log() method
- Python | Tensorflow abs() method
- Python | sympy.S() method
- Python | sympy.ff() method
- Python | sympy.rf() method
- Python PIL | eval() method
- Python | Tensorflow exp() method
- Python | os.ctermid() method
- Python | os.lchown() method
- Python | os.fchown() method
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.



