Skip to content

Instantly share code, notes, and snippets.

@schinken
Created April 22, 2012 11:15
Show Gist options
  • Save schinken/2463654 to your computer and use it in GitHub Desktop.
Save schinken/2463654 to your computer and use it in GitHub Desktop.
Mode
The mode of an image defines the type and depth of a pixel in the image. The current
release supports the following standard modes:
1 (1-bit pixels, black and white, stored as 8-bit pixels)
L (8-bit pixels, black and white)
P (8-bit pixels, mapped to any other mode using a colour palette)
RGB (3x8-bit pixels, true colour)
RGBA (4x8-bit pixels, true colour with transparency mask)
CMYK (4x8-bit pixels, colour separation)
YCbCr (3x8-bit pixels, colour video format)
I (32-bit integer pixels)
F (32-bit floating point pixels)
PIL also supports a few special modes, including RGBX (true colour with padding) and RGBa
(true colour with premultiplied alpha).
You can read the mode of an image through the mode attribute. This is a string containing
one of the above values.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment