Page 1 of 1

syntax help

Posted: 2010-06-03T19:33:47-07:00
by toshog
hi all...

i'm trying to find any documentation on how to read the following line:

convert xc: -format "%[fx:$amount*pi/$w1]" info:

basically i'd like someone to explain the "xc:" part. i'm assuming that it stands for execute... is it? what about the rest?

i was googling to find something for imagemagick syntax but couldn't...

thanks...

Re: syntax help

Posted: 2010-06-03T19:51:11-07:00
by fmw42
toshog wrote:hi all...

i'm trying to find any documentation on how to read the following line:

convert xc: -format "%[fx:$amount*pi/$w1]" info:

basically i'd like someone to explain the "xc:" part. i'm assuming that it stands for execute... is it? what about the rest?

i was googling to find something for imagemagick syntax but couldn't...

thanks...

This is a calculation using -fx to compute a result using variables $amount and $w1 using the fx known contstant pi

The standard fx calculation has to work on some image. In this case it is xc: (which is basically a null image or placeholder for fx as an input image).

The way fx calculations work vs fx processing is the -format "%[fx: some formula]" info:

the -format tells it to do a computation and then info: tells it to return the calculation (information) to the terminal

see http://www.imagemagick.org/Usage/transform/#fx_escapes and http://www.imagemagick.org/script/fx.php and http://www.imagemagick.org/Usage/canvas/#solid

Re: syntax help

Posted: 2010-06-03T20:11:14-07:00
by toshog
fmw42 wrote: the -format tells it to do a computation and then info: tells it to return the calculation (information) to the terminal.
thanks. so if i understand correctly this whole line is used to return the result of ($amount*pi/$w1)? and the xc: is just a "wild card" for an image so convert doesn't complain? am i getting this correctly?

Re: syntax help

Posted: 2010-06-03T20:18:25-07:00
by fmw42
toshog wrote:
fmw42 wrote: the -format tells it to do a computation and then info: tells it to return the calculation (information) to the terminal.
thanks. so if i understand correctly this whole line is used to return the result of ($amount*pi/$w1)? and the xc: is just a "wild card" for an image so convert doesn't complain? am i getting this correctly?

Essentially thought not really a wild card but a null image. You can actually do calculations with a real image if you want to utilize things like the image width or height as fx arguments which are w and h ( or other image related things like mean, std, min, max etc)

convert realimage -format "%[fx:($amount*pi/w)]" info:

or put the result into another variable

var=`convert realimage -format "%[fx:($amount*pi/w)]" info:`

or

var=$(convert realimage -format "%[fx:($amount*pi/w)]" info:)

Re: syntax help

Posted: 2010-06-03T23:23:40-07:00
by toshog
understood. thank you.