Click here to Skip to main content
13,344,016 members (84,460 online)
Rate this:
Please Sign up or sign in to vote.
See more:
Most quantizer algorithms reduce the number of colors in an image, but the colors appear as dots throughout the image. When quantizing images which we know have a fixed number of colors, say, logos, it is desirable that similarly colored pixels are clustered together. Is there a quantizing algorithm that is suitable for this purpose?
Posted 23-Mar-10 3:14am
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

many quantization functions will allow you to control the amount of dithering that occurs once the output palette has been determined. dithering is what gives you the 'dots' - it's an attempt to blend two colors in order to better represent to original image.

if you can turn off dithering, you'll get nice clean edges between areas of solid color.
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

Threshold is the obvious dithering technique (or "quantization algorithm") that makes similar sections appear as a solid. If you want to perform a statistical analysis to decided which colors to use beforehand, you could then adjust each pixel according to which of those chosen colors it is closest to. This would give a cartoon look (i.e., looks like cell shading rather than interspersed dots), which I believe is what you are after. Not sure if there is a name for the algorithm which combines closest match and statistical analysis, but if not then just create it and give it any name you like (e.g., Smart Threshold). :)
Hiren Solanki 1-Sep-10 1:51am

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web04 | 2.8.180111.1 | Last Updated 23 Mar 2010
Copyright © CodeProject, 1999-2018
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100