possible documentation error in -fx in IM 6.4.1-1 Q16

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

possible documentation error in -fx in IM 6.4.1-1 Q16

Post by fmw42 »

There may be a documentation error (if not a real error in fx) on the page http://www.imagemagick.org/script/fx.php

The following does not seem correct to me:

sign(x): return 1.0 if x is less than 0.0 otherwise 0.0

For non-HDRI, I would expect sign(x) to return 0.0 if less than 0.0; otherwise 1.0
and for HDRI, , I would expect sign(x) to return -1.0 if less than 0.0; otherwise 1.0

When I try (Q16 and Q16-hdri, IM 6.4.1-2 Mac OSX Tiger)

convert xc: -format "%[fx:sign(0.5)]" info:
1

convert xc: -format "%[fx:sign(-0.5)]" info:
-1


However for Q16 non-HDRI

convert -size 10x10 xc:gray50 -fx "-u" tmp.miff

then -verbose info says it is constant 0.



Can you verify? What is the expected behaviour for 1) the documentation 2) fx escapes and 3) -fx;
for non-HDRI and for HDRI.

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

Re: possible documentation error in -fx in IM 6.4.1-1 Q16

Post by magick »

We fixed the sign() documentation, expect an update by sometime tomorrow.

To get negative values, explicitedly specify a floating point format:
  • convert -size 10x10 xc:gray50 -fx "-u" -define quantum:format=floating-point tmp.miff
Post Reply