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...
syntax help
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: syntax help
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
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?fmw42 wrote: the -format tells it to do a computation and then info: tells it to return the calculation (information) to the terminal.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: syntax help
toshog wrote: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?fmw42 wrote: the -format tells it to do a computation and then info: tells it to return the calculation (information) to the terminal.
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
understood. thank you.