On 2018-07-08 12:32, Christian Neyers wrote:
On 2018-07-07 14:50, Carlos E. R. wrote> Hi,
Do we have something that would round a number in a script?
I have:
case "$1" in 72.009|72) DPI=72 ;; 86.0044|86) DPI=86 ;; 96.01) DPI=96 ;; 240.005|240) DPI=240 ;; 149.99) DPI=150 ;; 265.99|266) DPI=266 ;; 299.999|300) DPI=300 ;; 265.989|266) DPI=266 ;; 359.99|359.994|360) DPI=360 ;; 359.99000000000000909) DPI=360 ;;
This is absurd. Now I have another value, 265.99000000000000909 and I have to add another exception. I think I can write up my own tool, but perhaps it already exists :-?
What do you want to achieve and where do these numbers come from? Maybe you could work something out in the prior step or the one after this.
No. The numbers are generated by "identify", part of the ImageMagick(1). I can not alter the output. identify - describes the format and characteristics of one or more image files. The code section now is: "image/png") NOMBRE=`basename "$FILE" png` NOMBRECMPLTO=$DIRECTORIO/$NOMBRE echo calculating resolution set -- $(identify -units PixelsPerInch -format "%x %y %z" "$FILE") DPI=`LC_NUMERIC=en_GB.utf8 printf "%.0f\n" $1` and is working fine - at least in this respect :-) -- Cheers / Saludos, Carlos E. R. (from 42.3 x86_64 "Malachite" at Telcontar)