Wolfram Language

New Color Quantization Methods

There are new methods and significant speed and quality improvements introduced in ColorQuantize. These improvements also impact export to image file formats such as "GIF" that perform quantization.

Calculate how many different colors are in the picture.

Export the image to GIF and check the size of the output files.

Reduce the number of colors in the image with minimal quality loss.

The resulting image uses only 64 different colors.

Quantization decreases the file size when exporting to GIF.

The difference between the original and the image after quantization can best be seen when zooming into a small region of the image.

ColorQuantize now supports three methods of quantization. Compare the results of all three methods, depending on the desired number of colors in the resulting image.

If you have a predefined set of colors that you can use, ColorQuantize can assign one of these colors to each pixel to best resemble the original image.

The preceding example shows quantization with dithering, which is the default in ColorQuantize. Dithering can be turned off as well.

Related Examples

de es fr ja ko pt-br zh