More colors than I asked for with -colors and -map?

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: More colors than I asked for with -colors and -map?

Post by anthony »

See IM exmaples...
http://www.imagemagick.org/Usage/quantize/#map_common

Sorry no specific example here, I should add one.

Specifically Operators in IM will be applied to each image in the current image sequence, separate to each other. As such you get 12 (or less) best colors for each image, but that adds up to more that 12 colors over ALL the images.

You can specify it to quantize of all the images using "+map" but this only generates a map of the common 256 colors. without generating the map separatally. No way of specifying the color limit. In an API however you can specify that color limit.


NOTE: I was the author of Anthonys' X Windows Icon Library (which was started in 1991, pre-dating the WWW).
http://www.cit.gu.edu.au/~anthony/icons/
As such I know exactly the troubles you are going though.
See the old documentation area
http://www.cit.gu.edu.au/~anthony/icons/docs/
and specifically color selection notes...
http://www.cit.gu.edu.au/~anthony/icons ... olors.html

The biggest problem I had which was not documented was dithering.
When using a small number of colors for a small image a psuedo-random dither like IM's hilbert curve error correctly dither, or even a simpler floyd-stienberg error correction dither (see http://www.imagemagick.org/Usage/quantize/#dither_error )
produces a horible looking result.

Idealy a http://www.imagemagick.org/Usage/quanti ... red-dither should be used with low color and small icon like images to produce a much better looking result. However at the moment ordered dither in IM can only used 'fixed' mathematically generated color tables, and not just a collection of 'best' colors.

There is some algorithm that will allow you to use a set of specific colors for ordered dithering, and I have an idea of how it should be implemented, but at this time it is not available in IM. Sorry about that.

Because of my background in icons, and now GIF animations, I definateally would like to see an any color ordered dither implemented, but until I have time from other more pressing concerns this is not posible.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply