Requested Enhancement To List of String Formats
Posted: 2008-02-25T18:05:59-07:00
I know you all are busy, so this is not a high priority, but a when you can request (or add to enhancement list) as there are workarounds, but I use them frequently when doing scripting. Would it be possible to add a few more string formats to the list you have to be able to retrieve the min, max, mean and standard deviation from an image channel or a grayscale image? These could potentially be %L, %H, %M and %S (or whatever you want) so that I could do something like:
mean=`convert <rgbimage> -channel Red -separate -format "%M" info:`
mean=`convert <grayscaleimage> -format "%M" info:`
to get and store the mean of the image, etc for std and min and max.
Or however that would be implemented appropriately.
Thanks for considering this.
Fred
P.S. My workaround for a grayscale image is as follows (with help from Anthony):
function imagestats
{
data=`convert $infile -verbose info:`
min=`echo "$data" | sed -n '/^.*Min:.*[(]\([0-9.]*\).*$/{ s//\1/; p; q; }'`
max=`echo "$data" | sed -n '/^.*Max:.*[(]\([0-9.]*\).*$/{ s//\1/; p; q; }'`
mean=`echo "$data" | sed -n '/^.*Mean:.*[(]\([0-9.]*\).*$/{ s//\1/; p; q; }'`
std=`echo "$data" | sed -n '/^.*Standard.*[(]\([0-9.]*\).*$/{ s//\1/; p; q; }'`
}
mean=`convert <rgbimage> -channel Red -separate -format "%M" info:`
mean=`convert <grayscaleimage> -format "%M" info:`
to get and store the mean of the image, etc for std and min and max.
Or however that would be implemented appropriately.
Thanks for considering this.
Fred
P.S. My workaround for a grayscale image is as follows (with help from Anthony):
function imagestats
{
data=`convert $infile -verbose info:`
min=`echo "$data" | sed -n '/^.*Min:.*[(]\([0-9.]*\).*$/{ s//\1/; p; q; }'`
max=`echo "$data" | sed -n '/^.*Max:.*[(]\([0-9.]*\).*$/{ s//\1/; p; q; }'`
mean=`echo "$data" | sed -n '/^.*Mean:.*[(]\([0-9.]*\).*$/{ s//\1/; p; q; }'`
std=`echo "$data" | sed -n '/^.*Standard.*[(]\([0-9.]*\).*$/{ s//\1/; p; q; }'`
}