Finding channel mean Value

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
robuntu
Posts: 41
Joined: 2012-01-22T10:56:10-07:00
Authentication code: 8675308

Finding channel mean Value

Post by robuntu »

Hi,
I need to know which channel (c,m,y,k) is used less in an cmyk Image.
If I use

Code: Select all

identify -verbose pic.tif

I get the information, but is there a way to get only this value
for automatic controlling with something like

Code: Select all

identify -format %[mean usage of channel "c"]
or listed with all channels?

Great would be an output like:
c : 23%
m: 40%
y: 60%
k: 20%

Any Ideas?
Thanks for your help
Roland
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Finding channel mean Value

Post by fmw42 »

try as I said in your other post using .c or .y or .m or .k in the fx expression.

create cmyk image:
convert rose: -colorspace cmyk rose_cmyk.jpg

Then
convert rose_cmyk.jpg -format "%[fx:mean.c]" info:
or
identify -format "%[fx:mean.c]" rose_cmyk.jpg
0.0463268
Post Reply