get all channel depths

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
Posts: 27
Joined: 2010-09-08T22:16:11-07:00
Authentication code: 8675308
Location: Germany

get all channel depths

Post by dirk1976 » 2019-03-14T05:59:44-07:00

I need to get the depth for all channels. The simplest way is to use identify with the verbose option. But in IM7 this command is very time consuming. I think this belongs to the signature calculation.
Is it possible to get this information without signature calculation?
I already search for a format option, but don't find anything.


Posts: 11579
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: get all channel depths

Post by snibgo » 2019-03-14T06:34:47-07:00

"identify -verbose" will find the minimum number of bits needed for each channel. To do this, it needs to examine every value in every pixel, to find the number of significant binary digits. (This process could finish early if all channels need N digits, where N is the Q-number. But if the same code also calculates the signature, it won't finish early).

At the CLI, I don't think you can request just these depths for each channel. I suspect it can't be done even at the MagickCore level.
snibgo's IM pages:

User avatar
Posts: 24886
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: get all channel depths

Post by fmw42 » 2019-03-14T08:51:34-07:00

You can try using the string format %[depth] on each channel.

Code: Select all

magick image -separate -format "%[depth]\n" info:

Post Reply