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
Documentation Error on -fx
Re: Documentation Error on -fx
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.
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: Documentation Error on -fx
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/
https://imagemagick.org/Usage/