ColorQuantize

ColorQuantize[image,n]

gives an approximation to image that uses only n distinct colors.

Details and Options

  • ColorQuantize by default uses dithering to diffuse color quantization errors.
  • With Dithering->False, no dithering is applied.
  • ColorQuantize works with grayscale, color, and arbitrary multichannel images.
  • For grayscale and images with three color channels, ColorQuantize works on the original color space. For other color images, quantization is done in the Lab color space. For images with Automatic color space, ColorQuantize works on pixel intensities by averaging over all channels.
  • ColorQuantize works with Image3D objects.

Examples

open allclose all

Basic Examples  (3)

Approximate a true color image with 10 discrete color values:

In[1]:=
Click for copyable input
Out[1]=

Create a duotone image:

In[1]:=
Click for copyable input
Out[1]=

Five discrete color values in a 3D image:

In[1]:=
Click for copyable input
Out[1]=

Options  (1)

Applications  (2)

Properties & Relations  (2)

See Also

ImageLevels  Binarize  ColorSeparate  ImageAdjust  ImageEffect  ImageType  FindClusters

Tutorials

Introduced in 2008
(7.0)
| Updated in 2012
(9.0)