Colour depth in bits-per-pixel

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?".
Post Reply
aja

Colour depth in bits-per-pixel

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

Re: Colour depth in bits-per-pixel

Post 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)
aja

Re: Colour depth in bits-per-pixel

Post 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?
Post Reply