Page 1 of 1
how to identify channel statistics with identify -format only
Posted: 2017-11-09T23:17:04-07:00
by AlexPUA
What is the format option(-s) to get info from "Channel statistics:" block of -verbose option without image conversions
Such as (for example)
identify -format "%f %[skewness]\n" filename.jpg
but for red (for example) channel - not for all image statistics
Channel statistics:
Pixels: 2920225
Red:
****
skewness: -1.67462
***
Image statistics:
Overall:
min: 0 (0)
max: 255 (1)
mean: 210.185 (0.824256)
standard deviation: 56.0961 (0.219985)
kurtosis: 1.51886
skewness: -1.45171
entropy: 0.700884
Re: how to identify channel statistics with identify -format only
Posted: 2017-11-09T23:23:09-07:00
by fmw42
See
http://www.imagemagick.org/script/escape.php. You need to use convert rather than identify to select the channel.
Code: Select all
convert filename.jpg -channel red -format "%f %[skewness]\n" info:
Re: how to identify channel statistics with identify -format only
Posted: 2017-11-10T00:56:36-07:00
by AlexPUA
Thanks a lot !
So, a got the way to get image composite and channels info in-one-line is (in Windows BAT format)
identify -format "%%f %%[width] %%[height] %%[size] %%[colors] %%[entropy] %%[kurtosis] %%[mean] %%[skewness] %%[standard-deviation] " %1 >> %1.iinfo
convert %1 -channel red -format "red %%[entropy] %%[kurtosis] %%[mean] %%[skewness] %%[standard-deviation] " info: >> %1.iinfo
convert %1 -channel green -format "green %%[entropy] %%[kurtosis] %%[mean] %%[skewness] %%[standard-deviation] " info: >> %1.iinfo
convert %1 -channel blue -format "blue %%[entropy] %%[kurtosis] %%[mean] %%[skewness] %%[standard-deviation]\n" info: >> %1.iinfo
It's not so fast (effective) as "identify -verbose" but it works
Re: how to identify channel statistics with identify -format only
Posted: 2017-11-10T02:49:03-07:00
by snibgo
If you put it all in one long "convert", you need run only one "convert", and read the image file once.
If you have multiple "-format" settings, you should "+write info" after each one.
Re: how to identify channel statistics with identify -format only
Posted: 2017-11-10T19:30:39-07:00
by fmw42
If you use fx statistics (relative to gray levels in the range 0 to 1), you can use channel specifiers. So for example:
Code: Select all
identify -format "rmean=%[fx:mean.r]\ngmean=%[fx:mean.g]\nbmean=%[fx:mean.b]\nrstd=%[fx:standard_deviation.r]\ngstd=%[fx:standard_deviation.g]\nbstd=%[fx:standard_deviation.b]\n" logo:
rmean=0.899307
gmean=0.887126
bmean=0.898288
rstd=0.271931
gstd=0.277917
bstd=0.25138
You can add skewness and kertosis also. See
http://www.imagemagick.org/script/fx.php
You can also multiply by 255 if you want in the fx: brackets if you want to scale to the range 0 to 255