Page 1 of 1

Scientific to decimal?

Posted: 2014-02-18T19:04:52-07:00
by RedFlyer
I'm using

Code: Select all

identify -format "%[fx:w*h]" filename
to get the total pixels of an image, but when the number gets to big IM spits it out in scientific notation.
Is there any way to get it to only use decimals for the output?

Re: Scientific to decimal?

Posted: 2014-02-18T19:17:56-07:00
by snibgo

Code: Select all

identify -ping -precision 12 -format "%[fx:w*h]" vbig.png
This will help only up to a certain limit.

Re: Scientific to decimal?

Posted: 2014-02-18T19:28:58-07:00
by fmw42
I think the max for -precision is 15

If on Linux/Mac and you need a bigger number than that, then use bc

ww=`identify -ping "%w" image`
hh=`identify -ping "%h" image`
echo "$ww*$hh" | bc`

There is likely something similar in Windows, but I do not know. One of the Windows users may be help on that.

Re: Scientific to decimal?

Posted: 2014-02-18T19:51:26-07:00
by snibgo
The Windows "set /A" is integers only, up to 2e10. Where necessary I use my own indefinite precision calculator.

Re: Scientific to decimal?

Posted: 2014-02-19T11:49:45-07:00
by RedFlyer
Fantastic, thank you so much.