Colour representation in Pillow

Martin McBride, 2020-09-19
Tags colour rgb transparency greyscale
Categories pillow
In Python libraries

Colour is a vital aspect of computer imaging, of course. Pillow supports various different raster image formats, which in turn support different ways of representing colour:

  • Light and colour - a basic overview of how the human eye detects colour.
  • RGB colour and other colour spaces
  • Colour depth - modern bitmap image formats typically use 8 bits per colour per pixel to represent colours, but Pillow also supports several alternatives, mainly used by older image formats.

Pillow refers to the combination of a colour space and a colour depth as the mode of the image. Pillow supports a fixed set of modes.

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