Page 1 of 1

identify -format %[mean] gives 65535 on 8-bit gray image

Posted: 2015-11-04T14:44:27-07:00
by inwelkin@gmail.com
Hi,

I have an image with following info:
gray.jpg JPEG 12558x8776 12558x8776+0+0 8-bit PseudoClass 256c 1.937MB 0.000u 0:00.000
I am using identify to get mean gray value and standard deviation of this image:

Code: Select all

identify -format %[mean]%[standard-deviation] gray.jpg
The results returned are: 65535, 1396.33

Why is the max and std exceeding 2^8 - 1? Please advise.

Thank you,
Muye

Re: identify -format %[mean] gives 65535 on 8-bit gray image

Posted: 2015-11-04T15:18:25-07:00
by snibgo
I assume you are using Q16 ImageMagick. When it reads images, it expands values to 16 bits, and shows those values.

Re: identify -format %[mean] gives 65535 on 8-bit gray image

Posted: 2015-11-04T15:42:00-07:00
by inwelkin@gmail.com
Hi,

Thanks! Yes, I use IM 6.7.8 Q16. Though when I run

Code: Select all

identify -verbose gray.jpg 
,
I got the output in desired range:
Channel statistics:
Gray:
min: 0 (0)
max: 255 (1)
mean: 5.43318 (0.0213066)
standard deviation: 16.1351 (0.0632749)
Why's the output from the two commands different? Is there a way I can get mean = 5.43318 from "identify -format %[mean]"?

Re: identify -format %[mean] gives 65535 on 8-bit gray image

Posted: 2015-11-04T16:10:53-07:00
by fmw42
try

Code: Select all

identify -format %[fx:255*mean]" yourimage

Re: identify -format %[mean] gives 65535 on 8-bit gray image

Posted: 2015-11-05T13:59:52-07:00
by inwelkin@gmail.com
This worked, thanks a lot!