Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
RedFlyer
Posts: 8 Joined: 2014-01-30T16:57:55-07:00
Authentication code: 6789
Post
by RedFlyer » 2014-02-18T19:04:52-07:00
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?
snibgo
Posts: 12159 Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK
Post
by snibgo » 2014-02-18T19:17:56-07:00
Code: Select all
identify -ping -precision 12 -format "%[fx:w*h]" vbig.png
This will help only up to a certain limit.
fmw42
Posts: 25562 Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA
Post
by fmw42 » 2014-02-18T19:28:58-07:00
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.
snibgo
Posts: 12159 Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK
Post
by snibgo » 2014-02-18T19:51:26-07:00
The Windows "set /A" is integers only, up to 2e10. Where necessary I use my own indefinite precision calculator.
RedFlyer
Posts: 8 Joined: 2014-01-30T16:57:55-07:00
Authentication code: 6789
Post
by RedFlyer » 2014-02-19T11:49:45-07:00
Fantastic, thank you so much.