How can I show histogram of an image?

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?".
Locked
User avatar
magick
Site Admin
Posts: 11254
Joined: 2003-05-31T11:32:55-07:00

Post by magick »

You can use MagickLib::GetNumberColors() to write the image histogram to a file or you can iterate over the image pixels and create the histogram yourself.

User avatar
anthony
Posts: 8884
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Post by anthony »

What would be nice is to be able to generate a color map file.
That is a image that contains one color pixel for each color that exists
in the image.

EG: convert logo: -colors 32 -colormap t.gif

will return an image that is 1x32 pixels in size at the most.

This minimal image can then be used for a -map argument.
and its size can be used as a final color count.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/

Locked