Unique Colors

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
spieler
Posts: 47
Joined: 2004-10-08T09:03:16-07:00
Location: Iowa

Unique Colors

Post by spieler »

I have a tiff file with LZW compression.
When I do an identify -verbose on it I get
Colors: 256.
When I do an identify -format %k on it, I get
2.

Another software program also reports 256, so I'm assuming that's more or less what the LZW compression gives (at least in this case).

Would it be possible to get Unique Colors added to the verbose output? It can be a little confusing thinking an image has 256 colors when in fact it is monochrome!

Thanks!
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Post by magick »

The verbose output of the identify command displays the image histogram. The histogram consists of all the unique colors in the image.
spieler
Posts: 47
Joined: 2004-10-08T09:03:16-07:00
Location: Iowa

Post by spieler »

I see that the number of values in the histogram does match the number of unique colors, but I'd rather not have to count them to find how many there are.

To me it seems contradictory to state 256 colors when there are only 2 unique colors. After some digging, I know that's because of the LZW compression.

I think this is more of a display issue than anything. I will still be using %k for my applications, but it would just be handier to have the number of unique colors displayed on the verbose output. Practically speaking, it probably would not be a difficult change to make. IMO, it would enhance the output, but not all may necessarily agree.

Thanks for your consideration. Or if you don't consider this at least thanks for reading and commenting!

Here's part of the output I receive.

Code: Select all

> identify -format %k a.tif
2
> identify -verbose -strip a.tif
Format: TIFF (Tagged Image File Format)
Class: PseudoClass
Geometry: 1734x2156
Type: Bilevel
Endianess: MSB
Colorspace: Gray
Channel depth:
  Gray: 1-bit
Channel statistics:
  Gray:
    Min: 0 (0)
    Max: 1 (1)
    Mean: 0.951333 (0.951333)
    Standard deviation: 0.21517 (0.21517)
Colors: 256
Histogram:
  181941: (  0,  0,  0)       black
 3556563: (255,255,255)       white
Rendering intent: Undefined
Resolution: 204x196
Units: PixelsPerInch
Filesize: 172.514kb
Background color: white
Border color: #DFDFDF
Matte color: grey74
Compression: LZW
Orientation: TopLeft
Version: ImageMagick 6.2.9 08/11/06 Q8 http://www.imagemagick.org
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Post by magick »

We fixed the problem you reported in ImageMagick 6.3.0 Beta available sometime tommorrow. Thanks.
Post Reply