Page 1 of 1

Colour depth in bits-per-pixel

Posted: 2007-06-06T08:39:59-07:00
by aja
How can I determine the colour depth of an image in bits-per-pixel?

I expected it to be a no-brainer with a simple identify, but was wrong. For example, this is what an identify output of a 24-bpp JPEG looks like:
logo.jpg JPEG 640x480 640x480+0+0 DirectClass 8-bit 88.0859kb
Notice the 8-bit (!) part. identify -verbose also refuses to list a nice and plain "24" anywhere... :( Am I overlooking something here?

Re: Colour depth in bits-per-pixel

Posted: 2007-06-06T10:47:22-07:00
by magick
Identify -verbose lists your image depth. For example:
  • Channel depth:
    Red: 8-bit
    Green: 8-bit
    Blue: 8-bit
    Channel statistics:
    Red:
    Min: 0 (0)
    Max: 255 (1)
    Mean: 228.364 (0.895545)
    Standard deviation: 70.8226 (0.277736)
    Green:
    Min: 6 (0.0235294)
    Max: 255 (1)
    Mean: 229.059 (0.898272)
    Standard deviation: 62.94 (0.246824)
    Blue:
    Min: 10 (0.0392157)
    Max: 255 (1)
    Mean: 232.288 (0.910932)
    Standard deviation: 55.8149 (0.218882)

Re: Colour depth in bits-per-pixel

Posted: 2007-06-07T00:48:07-07:00
by aja
I noticed those information of course ;)... so, I gather from your answer that I'll have to calculate the overall bits-per-pixel depth myself from #channels x bits-per-channel, and that I cannot grab (or, grep ;) ) that from identify's output directly. Right?