Page 1 of 1

Return values for overall image brightness, contrast and saturation

Posted: 2019-04-16T07:37:52-07:00
by TheWox
Hi all.

I am looking to generate point values that would represent an image's overall brightness, contrast and degree of colour saturation.

I see the verbose identify command doesn't show these, and I haven't been able to find a definitive set of command line arguments that produce a predictable result. Can anyone advise?

Re: Return values for overall image brightness, contrast and saturation

Posted: 2019-04-16T07:56:03-07:00
by snibgo
There are different definitions for "saturation". Personally, I use the C channel of HCL. You might prefer S of HSL, or something else.

For example:

Code: Select all

magick toes.png -colorspace HCL -format "light=%[fx:mean.b]\ncont=%[fx:standard_deviation.b]\nsat=%[fx:mean.g]" info:

light=0.495456
cont=0.146745
sat=0.114103
These are on a scale of 0.0 to 1.0, although the maximum standard_deviation for small images, in recent IM, is sqrt(1/2) = 0.707107.