Image operations recipes in Pillow

Martin McBride, 2020-10-11
Tags image processing recipes solarize posterize colorize autocontrast
Categories pillow
In Python libraries

The ImageOps module contains a collection of functions that perform various image operations in a single call.

Operations fall into several groups:

This module is described as "experimental" in the Pillow documentation. They are actually pretty reliable, although they should only be used with 8 bit RGB and greyscale images. There are other ways of performing these operations using standard functions, but that would usually require multiple function calls, so this module is worth knowing about.

Test image

We will use an image called carousel-small.jpg to illustrate these functions:

If you found this article useful, you might be interested in the book Computer Graphics in Python or other books by the same author.