PIL (Pillow) Integration
Explore how to integrate Pycairo with the Pillow library to read various image formats like JPEG and write graphics files. Understand converting image data between Pycairo and Pillow to handle formats not natively supported by Pycairo, using alpha channels and byte order adjustments.
We'll cover the following...
We'll cover the following...
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 ...