Equality operator in fx image

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
Danack
Posts: 73
Joined: 2013-10-14T10:00:25-07:00
Authentication code: 6789

Equality operator in fx image

Post by Danack »

Hi,

I think I've discovered a bug in the equality operator in the fx operator.

Code: Select all

    convert -size 256x256 "xc:pink" input1.jpg
    convert -size 256x256 "gradient:black-white" input2.jpg
    convert input1.jpg input2.jpg -fx "colorInt=int(256 * v.p{0,j}.lightness); pos = int(256 * i/w); (int(pos) >= int(120) && int(pos) <= int(120))" output1.png
    convert input1.jpg input2.jpg -fx "colorInt=int(256 * v.p{0,j}.lightness); pos = int(256 * i/w); int(pos) == int(120) " output2.png
In the above example the single equality operator "int(pos) == int(120)" should be equivalent to "(int(pos) >= int(120) && int(pos) <= int(120)" however the two output images are different.

output1.png appears correct - or at least what I expect:
Image

output2.png appears incorrect
Image
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Equality operator in fx image

Post by magick »

We can reproduce the problem you posted and have a patch in ImageMagick 6.8.9-2 Beta available by sometime tomorrow. Thanks.
Post Reply