Understanding the theory of color reductuion

Questions and postings pertaining to the development of ImageMagick, feature enhancements, and ImageMagick internals. ImageMagick source code and algorithms are discussed here. Usage questions which are too arcane for the normal user list should also be posted here.
Post Reply
barrettsmail

Understanding the theory of color reductuion

Post by barrettsmail »

Not sure this the right topic. I am looking for a good tutorial on the basci algorithm for color reduction. Thanks :D
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Understanding the theory of color reductuion

Post by magick »

See http://www.imagemagick.org/script/quantize.php for a discussion of ImageMagick's color reduction algorithm.
barrettsmail

Re: Understanding the theory of color reductuion

Post by barrettsmail »

Thanks.

I had found a web article that is almost word for word identical your reference. That document credited:

"Paul Raveling, USC Information Sciences Institute, for the original idea of using space subdivision for the color reduction algorithm. With Paul's permission, this document is an adaptation from a document he wrote."

I have searched sites such as ACM for that article. Do you know where to find it?

The overview of the algorithm is clear, but I am confused about the node strucure and the reason for the parameters and how they are related to complete process.
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Understanding the theory of color reductuion

Post by magick »

There is no original article. We based the ImageMagick color reduction algorithm on some original source code that Paul provided many years ago. There are tens of different methods for color reduction in the wild including those based on histogram analysis, neural networks, and spatial subdisvision (both k-means and oct-tree). If you want to understand ImageMagick's method we refer you to the article and the source code. Download the ImageMagick source distribution and look at magick/quantize.c. The nodes are inner and leaf nodes of an oct-tree. The tree is populated based on the image pixels and then a reduction process starts where nodes deep in the tree are combined with near-by nodes such that the color error is minimized. When the number of unique colors is equal or less than the desired color count, the original image is replaced by the closest color found in the tree.
barrettsmail

Re: Understanding the theory of color reductuion

Post by barrettsmail »

Thanks for your supe answer. I suspected that may be the case. Being lazy, I wanted a short cut. Again thanks
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Understanding the theory of color reductuion

Post by anthony »

While I do not go into the nitty gritty of Color Reduction I talk about it and its effects in IM Examples, Quantization and Dithering
http://www.imagemagick.org/Usage/quantize/
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply