Quantization (image processing)

This is an old revision of this page, as edited by 131.107.0.80 (talk) at 00:32, 15 August 2005. The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

Quantization, involved in image processing, is the process seeking to reduce the number of colors required to represent an image.

The infinite number of colors available through the lens of a camera is impossible to display on a computer screen. Since a computer can display only a finite number of colors, quantization is always necessary.

Many early computers were very limited in the number of colors they could display at one time. However, modern computers can usually display far more colors than are humanly distinguishable.

Most quantization algorithms allow you to set exactly how many colors you want to use.

When you set the very small number of colors available on early computers, different quantization algorims produced very different-looking output images.

So people spent a lot of time trying to make sophisticated quantization algorithms that gave the impression of being the most "lifelike".

When you set the very large (but still finite) number of colors available on a modern computer, just about every quanization algorithm produces an output image indistinguishable from the human eye from every other quantinization algorithm and from the view through the lens directly.

Although more frequent in the past, currently color quantization is only used in 8-bit (256 color) images, as GIF images and some PNG images.

Using "nearest-neighbor" quantization, the fewer colors you allow, the small the PNG file becomes. On the other hand, sophisticated "random dithering" can actually inflate PNG file size.

A standard quantization algorithm works in 2 steps:

  1. Analyze the image's color usage to select the new color palette.
  2. Dither the image to the new color palette.

Quantization algorithms

An usual quantization algorithm is the Octree-based algorithm, as described in the MSDN article on ASP.NET color quantization

Another popular quantization algorithm is the "median cut" algorithm.