%[fx:intensity] like all -fx operations will report values in the range of 0 to 1 not 0 to quantum-max, so you need to scale your values.
Try
convert image -format "%[fx:int(255*intensity)]" info:
but I am not sure that is the same as the mean.
mean=`convert image -format "%[mean]" info:`
convert xc: -format "%[fx:255*$mean/65535]" info:
or
echo "scale=0; $(convert image -format "%[mean]" info:) * 255/65535" | bc
or
convert xc: -format "%[fx:int($(convert image -format "%[mean]" info:)*255/65535)]" info:
(anyone know of a cleaner shorter way to do this with only fx)
(I am on a 16-bit system, so I need to scale $mean by 255/quantum-max. On a 8-bit system, I don't think you would not need the second step)
For example if I use a standard image (logo: or rose:), I get
time convert logo: -format "%[fx:int(255*intensity)]" info:
255
real 0m0.568s
user 0m0.100s
sys 0m0.042s
time mean=`convert logo: -format "%[mean]" info:`; convert xc: -format "%[fx:int(255*$mean/65535)]" info:
real 0m0.196s
user 0m0.118s
sys 0m0.041s
230
time convert rose: -format "%[fx:int(255*intensity)]" info:
47
real 0m0.496s
user 0m0.022s
sys 0m0.024s
time mean=`convert rose: -format "%[mean]" info:`; convert xc: -format "%[fx:int(255*$mean/65535)]" info:
real 0m0.069s
user 0m0.022s
sys 0m0.024s
105
and the times are better for the second method.
With your image I get:
time convert D-20080425-095650.jpg -format "%[fx:int(255*intensity)]" info:
9
real 0m1.599s
user 0m0.966s
sys 0m0.171s
time mean=`convert D-20080425-095650.jpg -format "%[mean]" info:`; convert xc: -format "%[fx:int(255*$mean/65535)]" info:
real 0m1.378s
user 0m1.158s
sys 0m0.169s
100
See:
viewtopic.php?f=3&t=10984
for a discussion of how the r,g,b channels are combined with intensity.