Python Pillow (PIL) Tutorial – Image Manipulation

Python Imaging Library (also known as PIL or Pillow) is a free and open source library use for image manipulation and processing in Python. Pillow is the newer version, built upon PIL with greater support for Operating Systems and Python3. We’ll learn all about the different things Pillow can do in this Python Pillow Tutorial series.


Downloading and Installing Pillow

We can use the pip install command from the command prompt to download and install the Pillow library. If you have trouble with this part, refer to this guide.

pip install pillow

The above command will install pillow. However, the name by which you import it will be PIL, so don’t mix up the two.

from PIL import Image

The Image module contains most of the functions we’ll be using.

Note: You can choose to use pillow only for the image processing, and then use other libraries to display the image, e.g: Tkinter PhotoImage, which can be used to display Pillow images on the Tkinter GUI.


Pillow Tutorials

Below is a compilation of many Pillow Tutorials, each focused on a single concept such as Reading, Rotating, Cropping or Resizing images. By the time you complete all of them, you should be fairly proficient in using the Pillow library for even advanced tasks.

Try following them in order for the best experiance.

  1. Reading Images
  2. Retrieving Image Attributes
  3. Resizing Images
  4. Rotating Images
  5. Cropping Images
  6. Converting Images
  7. Pasting Images
  8. Blurring Images
  9. Creating Thumbnail
  10. Drawing Shapes with Pillow

Further Reading

You can also use the Pillow Library together with other libraries like Numpy. You can use Numpy to store image data, and convert that data to images and vice versa. It’s a topic worth checking out for those interested in a challenge.

Pillow also has several uses in Machine Learning due to it’s image processing abilities.

Here’s a link to the Pillow documentation as well, where you can find additional information.


This marks the end of the Python Pillow (PIL) Tutorial. Any suggestions or contributions for CodersLegacy are more than welcome. Questions regarding the tutorial can be asked in the comments section below.

Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments