Process Images Using the Pillow Library and Python (Overview)
When you look at an image, you see the objects and people in it. However, when you read an image programmatically with Python or any other language, the computer sees an array of numbers. In this video course, you’ll learn how to manipulate images and perform basic image processing using the Python Pillow library.
Pillow and its predecessor, PIL, are the original Python libraries for dealing with images. Even though there are other Python libraries for image processing, Pillow remains an important tool for understanding and dealing with images.
To manipulate and process images, Pillow provides tools that are similar to ones found in image processing software such as Photoshop. Some of the more modern Python image processing libraries are built on top of Pillow and often provide more advanced functionality.
In this video course, you’ll learn how to:
- Read images with Pillow
- Perform basic image manipulation operations
- Use Pillow for image processing
- Use NumPy with Pillow for further processing
- Create animations using Pillow
In this video course, you’ll get an overview of what you can achieve with the Python Pillow library through some of its most common methods. Once you gain confidence using these methods, then you can use Pillow’s documentation to explore the rest of the methods in the library. If you’ve never worked with images in Python before, this is a great opportunity to jump right in!
Note that this course uses bpython, but all code will also work in the Python standard REPL.
00:00 Process Images Using the Pillow Library and Python.
00:05 When you look at an image, you see the objects and people in it. However, when you read an image programmatically with Python or any other language, the computer sees an array of numbers. In this course, you’ll learn how to manipulate images and perform basic image processing using the Python Pillow library.
00:24 Pillow and its predecessor, PIL, are the original Python libraries for dealing with images. Even though there are other Python libraries for image processing, Pillow remains an important tool for understanding and dealing with images. To manipulate and process images, Pillow provides tools that are similar to ones found in image processing software such as Photoshop and GIMP. In this tutorial, you’ll learn how to read images with Pillow, perform basic image manipulation operations, use Pillow for image processing, use NumPy with Pillow for further processing, and create animations using Pillow and NumPy.
01:03 This course provides an overview of what you can achieve with the Pillow library through some of its most common methods. Once you gain confidence using these methods, then you can use Pillow’s documentation to explore the rest of the methods in the library. If you’ve never worked with images in Python before, this is a great opportunity to jump right in.
01:22 You’ll use several images which are included in the course materials, so make sure you download those and unzip them before you get started.
01:31 Any code that you see running in the REPL will be using the bpython interpreter. This is a replacement Python interpreter that offers a number of enhancements, including code highlighting and suggestions.
01:42
But any code you see running on-screen will work in the standard Python REPL, which is typically accessed by typing python
or python3
at your terminal or command-line prompt. So now you know what you’ll be covering, and with those images in hand, you are now ready to get started with Pillow.
Bartosz Zaczyński RP Team on Aug. 16, 2023
@Samantha Atkins You can find them in the supporting materials of the linked written tutorial or by browsing the corresponding GitHub repository.
Luke Bam on May 2, 2024
When using a context manager to load image data into a variable, why is it acceptable to reference ‘img’ outside of the context manager? e.g:
with Image.open(filename) as img:
img.load()
# and then ...
img.show()
img.resize()
Shouldn’t img only be reference inside the conext manager?
Become a Member to join the conversation.
Samantha Atkins on Aug. 15, 2023
Where are the images mentioned in the intro? I don’t see them in the downloads.