O'Reilly logo

Computer Vision with Python 3 by Saurabh Kapur

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Image enhancement

Image enhancement involves operations such as changing the contrast, brightness, color balance, or sharpness of an image. Pillow provides an ImageEnhance module, which has functions that can help you perform the earlier mentioned operations.

We will begin with importing the ImageEnhance module using the following code:

>>> from PIL import ImageEnhance

After importing the library, let us see how to use the functions available in the library. First we will see how to change the brightness of an image:

  • Change brightness of an image: We will use the following code to change the brightness:

        >>> enhancer = ImageEnhance.Brightness(img)        >>> enhancer.enhance(2).show()

The enhance() function takes a float as an argument, which ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required