Page 1 of 1

Unique Colors

Posted: 2006-10-06T01:27:11-07:00
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!

Posted: 2006-10-06T05:12:19-07:00
by magick
The verbose output of the identify command displays the image histogram. The histogram consists of all the unique colors in the image.

Posted: 2006-10-06T08:07:42-07:00
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

Posted: 2006-10-06T12:53:21-07:00
by magick
We fixed the problem you reported in ImageMagick 6.3.0 Beta available sometime tommorrow. Thanks.