[magick-users] identify -verbose color count

Anthony Thyssen anthony at griffith.edu.au
Sun Jan 13 17:47:37 PST 2008


"Peter Pimley" on  wrote...
| 
| 
| Hello IM-ers.
| 
| On Imagemagick 6.3.5  (Q16, WinXP), I can do "identify -verbose
| my_tga_file.tga", and one line of the output states the number of colors
| the image has:
| 
| identify my_tga_file.tga | grep Colors:
|   Colors: 2274
| 
| 
| On Imagemagick 6.3.7 (again, Q16, WinXP), the color count is no longer
| part of the output.  Is this deliberate?
| 
| Is there an alternative, but equally easy way of obtaining the number of
| colors in am image?  I'm only dealing with 32 bit tgas, and these are
| quite easy to parse by hand.  So it's only a screen's worth of C to do
| it myself.
| 

Alturnative ways, is to ask specifically for the number of colors...

   identify -format %k image.png

Or generate a color map for the image...

   convert image.png  -unique-colors info:

The width of the resulting image is the number of unique colors
But it will also be listed with as a number with a 'c' on the end.


  Anthony Thyssen ( System Programmer )    <A.Thyssen at griffith.edu.au>
 -----------------------------------------------------------------------------
  `` I'm not bad.   I'm just drawn that way! ''  
                             - Jessica Rabbit -- "Who Framed Roger Rabbit"
 -----------------------------------------------------------------------------
     Anthony's Home is his Castle     http://www.cit.gu.edu.au/~anthony/


More information about the Magick-users mailing list