Color Quantization of Photographic Images I: Palette from Colors in the Image
Color quantization reduces the number of colors in an image to a limited set of distinct colors, called a palette.
This Demonstration illustrates how a photographic image can be quantized using a palette of up to eight colors present in the image.
While moving/creating/deleting the locators, select between one and eight pixels in the image on the left and see the pixel segments of the image having similar colors on the right. The colors of the selected pixels are displayed in the top right corner. Similarity of colors is evaluated by the Euclidean distance between their RGB values.
See also the histograms of the original and the quantized image at the bottom.