Adding the Image Enhancement section using the Pillow library
Among the libraries we imported at the beginning, there is Pillow. It contains a module named ImageEnhance
that can actually take care of all the features related to any kind of image enhancement for us. This means that we can use the Contrast
and Brightness
methods already included in Pillow’s ImageEnhance
module because all the functions we need, and many others, have been already implemented for us.
Pillow, or Python Imaging Library, is a very powerful library and it can do more than the things we are showing in this book. For this reason, we suggest taking a look at its official page on PyPI (https://pypi.org/project/Pillow/) and reading all the documentation contained there.
Figure 9.7: The Pillow page on PyPI
Let’s start with Contrast
.
Contrast
As shown in Figure 9.8, managing Contrast
with Pillow’s methods is really very simple: