PIL (Pillow) Integration

Learn how to integrate PIL (Pillow) with Pycairo.

Pillow is a Python raster imaging library. It can read and write various image file formats, and perform image manipulation.

Reading a JPEG file

Pycairo can create an ImageSurface from a PNG image, but it cannot read in any other type of image. We can use Pillow to open other types of images, such as JPEGs. This is how we can use Pillow to read in a JPEG file and create an ImageSurface:

Get hands-on with 1400+ tech skills courses.