QuantizeFilter

QuantizeFilter quantizes an image to a specified number of colors using an octtree algorithm. You can specify the number of color and whether to use Floyd-Steinberg error diffusion dithering or not. This is a very useful filter to use when you want to convert an image to use a colormap, for example, when you need to write an image out as a GIF file. The picture shows an image quantized to only a few levels, which can be useful to produce a "painted" effect.

QuantizeFilter
QuantizeFilter

Just for fun, here's the same image overlaid with black edges using the Edge, Grayscale and Invert filters.

QuantizeFilter
QuantizeFilter

Parameters:
  • int levels - The number of levels to dither to
  • boolean dither - true to use dithering to imrpove the quality
  • boolean serpentine - true to use a serpentine pattern which reduces "cascading" effects