Yes, I had never noticed that before. This will be very useful to replace several lines of code in many of my scripts.Fx includes the constant QuantumRange. Use it to scale Fx values to the quantum-depth of the ImageMagick release.
However, I am still puzzled how to do any calculation using fx escapes acting upon a string constant such as %{mean] for example.
What I came up with is three awkward alternates and am hoping there is a simpler way.
Code: Select all
mean=`convert image -format "%[mean]" info:`
convert xc: -format "%[fx:255*$mean/quantumrange]" info:
Code: Select all
echo "scale=0; $(convert image -format "%[mean]" info:) * 255/quantumrange" | bc
Code: Select all
convert xc: -format "%[fx:int($(convert image -format "%[mean]" info:)*255/quantumrange)]" info:
Code: Select all
convert image -format "%[fx:%[mean]*255/quantumrange}" info:
Thanks for any suggestions or improvements
Fred