Documentation Error on -fx

Post any defects you find in the released or beta versions of the ImageMagick software here. Include the ImageMagick version, OS, and any command-line required to reproduce the problem. Got a patch for a bug? Post it here.
Post Reply
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Documentation Error on -fx

Post by fmw42 »

On your page http://www.imagemagick.org/script/fx.php, you state regarding the ternary operator:

x ? y : z: ternary conditional expression, returns value y if x > 0, otherwise z; only one ternary conditional permitted per statement

However this does not work. The statement reads that -fx will test to see if x is positive. I have tried using -fx "(abs(u-v) - .01)?v:u" and I always get v for the result. I consulted with Anthony Thyssen and he tells me to use -fx "(abs(u-v) > .01)?v:u". That is x must be a test, not a value!

I think you need to rephrase your discussion of the ternary condition in your documentation to make this more clear. Something like

x>0 ? y : z: ternary conditional expression, returns value y if x > 0, otherwise z; only one ternary conditional permitted per statement

Thanks.

Fred Weinhaus
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Documentation Error on -fx

Post by magick »

The correct interpretation should be if the expression != 0 then y otherwise z. We will correct the documentation and verify its working properly (and if not apply a patch) for the upcoming ImageMagick 6.3.5-9 release.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Documentation Error on -fx

Post by anthony »

Just uploaded a minor fix to make it a floating point test for zero
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply