ColorQuantize
ColorQuantize[image]
gives an approximation to image by quantizing to distinct colors.
ColorQuantize[image,n]
uses at most n distinct colors.
ColorQuantize[image,{col1,…,coln}]
represents an image using only the n specified colors coli.
Details and Options
- Color quantization is the process of reducing the number of colors used to represent an image, typically for efficient file format compression such as GIF.
- ColorQuantize works with arbitrary 2D and 3D images.
- Quantization for color images is performed in the original color space. For images with Automatic color space, quantization is performed on pixel intensities by averaging over all channels.
- The following options can be given:
-
Dithering True whether to use dithering Method Automatic quantization method to use - Possible settings for Method include:
-
"MedianCut" recursively split the color space based on median pixel values "MinVariance" recursively split the color space so that the sum of variances in new subregions is minimal (Wu's algorithm) "Octree" create an octree from all image pixels and merge leaves until the n most representative remain
Examples
open allclose allBasic Examples (1)
Options (4)
Applications (5)
Properties & Relations (3)
Quantize the colors using the "Posterization" effect:
This is equivalent to quantizing each color channel individually:
Colors in the quantized image are also typically dominant colors of the image:
Compare with DominantColors:
Quantize an image using dominant colors given by DominantColors:
Quantize using the same number of colors, using all colors present in the image:
Possible Issues (1)
For images with Automatic color space, quantization is performed on pixel intensities by averaging over all channels:
Text
Wolfram Research (2008), ColorQuantize, Wolfram Language function, https://reference.wolfram.com/language/ref/ColorQuantize.html (updated 2019).
CMS
Wolfram Language. 2008. "ColorQuantize." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2019. https://reference.wolfram.com/language/ref/ColorQuantize.html.
APA
Wolfram Language. (2008). ColorQuantize. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/ColorQuantize.html