possible bug with new string formats in IM 6.4.0-3

Post any defects you find in the released or beta versions of the ImageMagick software here. Include the ImageMagick version, OS, and any command-line required to reproduce the problem. Got a patch for a bug? Post it here.
Post Reply
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

possible bug with new string formats in IM 6.4.0-3

Post by fmw42 »

I am seeing a difference in the min and max string formats compared to generating them using bash sed. Here is an example using a grayscale image of lena http://www.fmwconcepts.com/misc_tests/lena2g.jpg in IM 6.4.0-3 Q16:

Old Method using SED:

tmp2="lena2g.jpg"
data=`convert $tmp2 -verbose info:`
min=`echo "$data" | sed -n '/^.*[Mm]in:.*[(]\([0-9.]*\).*$/{ s//\1/; p; q; }'`
echo $min
max=`echo "$data" | sed -n '/^.*[Mm]ax:.*[(]\([0-9.]*\).*$/{ s//\1/; p; q; }'`
echo $max
mean=`echo "$data" | sed -n '/^.*[Mm]ean:.*[(]\([0-9.]*\).*$/{ s//\1/; p; q; }'`
echo $mean
std=`echo "$data" | sed -n '/^.*[Ss]tandard.*[(]\([0-9.]*\).*$/{ s//\1/; p; q; }'`
echo $std

from which I get:
min=0.109804
max=0.913725
mean=0.487606
std=0.183302



Using the new string formats and compute the statistics using bc into the same format, I get:

config=`convert -list configure`
quantum=`echo "$config" | sed -n 's/^QuantumDepth[ ]*\([0-9]*\)$/\1/ p'`
qmax=`echo "scale=0; (2^$quantum - 1) / 1" | bc`
echo $qmax
tmp2="lena2g.jpg"
data=`convert $tmp2 -verbose info:`
min=`convert $tmp2 -format "%[min]" info:`
min=`echo "scale=6; $min/$qmax" | bc`
echo $min
max=`convert $tmp2 -format "%[max]" info:`
max=`echo "scale=6; $max/$qmax" | bc`
echo $max
mean=`convert $tmp2 -format "%[mean]" info:`
mean=`echo "scale=6; $mean/$qmax" | bc`
echo $mean
std=`convert $tmp2 -format "%[standard-deviation]" info:`
std=`echo "scale=6; $std/$qmax" | bc`
echo $std

from which I get:
min=0
max=1.000000
mean=.487606
std=0.183302

Note the min and max seem to be at one digit precision.

Have I done something wrong or is this a bug in IM 6.4.0-3 in the min and max string formats?

Thanks

Fred
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: possible bug with new string formats in IM 6.4.0-3

Post by fmw42 »

Its not in the reporting of -verbose info:. I think it is in the return information from

convert image -format "%[min] info:
convert image -format "%[max] info:


Thanks

Fred
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: possible bug with new string formats in IM 6.4.0-3

Post by magick »

We have a patch for the problem you reported in ImageMagick 6.4.0-4 Beta available sometime tomorrow.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: possible bug with new string formats in IM 6.4.0-3

Post by fmw42 »

thanks
Post Reply