Page 1 of 1

Extracting statistical information of image

Posted: 2018-07-05T04:39:48-07:00
by kebs
Hello (first post here)

I have a large set of 3 channels images. I want to get the dynamic range of each of them.

Final objective: a csv file holding something like:

Code: Select all

#file;red-min;red-max;red-mean;red-stddev;green-min;green-max;....
"Identify" gives me all these informations:

Code: Select all

$ Identify -verbose myimage.png
but I can't figure out how to extract what I want.

I have checked this
https://www.imagemagick.org/script/identify.php
where it says that I can extract some information, for example using the "features" option:
https://www.imagemagick.org/script/comm ... p#features
But this is pretty much unclear.

On the other hand, I see this topic:
viewtopic.php?f=1&t=32127
where it says that this:

Code: Select all

$ identify -format "%[fx.mean.r]" myimage.png
should get me the mean value of red channel.
Unfortunately, it does not work (empty output).

Same empty output with:

Code: Select all

$ identify -format %[fx.mean.r] myimage.png
Is this a version problem? Or did I miss something in the syntax ?

FWIW:

Code: Select all

$ identify --version
Version: ImageMagick 6.7.7-10 2018-06-11 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2012 ImageMagick Studio LLC
Features: OpenMP  

Re: Extracting statistical information of image

Posted: 2018-07-05T05:07:13-07:00
by snibgo
I would use fx, for example:

Code: Select all

identify -format "%[fx:mean.r],%[fx:standard_deviation.r]" myimage.png
... but it needs colon ":" after "fx".

However, your version 6.7.7-10 is very old. I suggest you upgrade.

Re: Extracting statistical information of image

Posted: 2018-07-05T09:27:19-07:00
by fmw42
Linux distributions do not upgrade the version number, they just patch. The latest patch was on 6/11/2018. So it should be more or less up to date if they patched for everything and not just security changes.

Personally, I don't think that is a wise approach, since one never knows how well they patch things.

Re: Extracting statistical information of image

Posted: 2018-07-05T09:41:20-07:00
by snibgo
Ah, yes, thanks, Fred. I forgot to look at the date.

Perhaps you mean, "I do not think that is a wise approach...".

Re: Extracting statistical information of image

Posted: 2018-07-05T09:48:13-07:00
by fmw42
I have fixed it. I have a spell checker that changes what I want to write while I am typing it and this happens often. I have to go back and proof read afterwards.