OptionalcolorsThe number of colors to reduce the image to, an integer from 2 to 256. The palette is the image's own colors when
it has no more distinct ones than this, else colors chosen by median cut (the common colors get their own). Those
are averages of groups of similar colors, so e.g. pure black and white are only in it if the image has them in
quantity: give palette for exact colors. Default: 256. Give colors or palette, not both
OptionalditherHow the rounding error of each pixel is handled, which makes gradients look smooth with few colors:
'none' (each pixel takes its nearest color), 'floyd-steinberg' (the error goes to the next pixels, 7/16, 3/16,
5/16 and 1/16), 'atkinson' (the error goes to six neighbours, 1/8 each: lighter, more contrast), 'ordered' (a
regular 4x4 pattern of thresholds, no error spreading). Rows alternate direction for the error diffusions.
Default: 'none'
OptionalditherHow strongly to dither, from 0 (no spreading or threshold, the same as 'none') to 1 (the full error or
threshold). Default: 1
OptionalpaletteA fixed palette (1 to 256 colors, e.g. a Game Boy's four greens) that every pixel is mapped to, the nearest color
by its RGB. The alpha of the palette's colors is ignored. Give palette or colors, not both
Options of Image.quantize: either
colorsorpalette, and the dithering