Image processing in Python
To achieve our goal, we will need to carry out various image processing operations; for example, we will need to create an image from scratch, draw shapes onto an image, plot an image, open an image file, save an image to a file, compare two images, and possibly resize an image. In the following sections, we will explore some of the ways these operations can be performed when using Python.
Python image processing libraries
Out of the wealth of image processing libraries available for Python programmers, we chose to use two of the most prominent ones. These libraries will be briefly discussed in the following subsections.
The Pillow library
Pillow is a currently maintained fork of the original Python Imaging Library (PIL
). It offers support for opening, manipulating, and saving image files of various formats. Since it allows us to handle image files, draw shapes, control their transparency, and manipulate pixels, we will use it as our main tool...