possible bug fx escape IM 6.6.6.5
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
possible bug fx escape IM 6.6.6.5
ImageMagick 6.6.6-5 2010-12-13 Q16 HDRI Mac OSX Tiger
convert -size 10x10 xc:red xc:none +append testfx.png
x=5
y=5
convert testfx.png -format "%[fx:u.p{$x,$y}]" info:
convert: unable to parse expression `' @ error/fx.c/FxGetSymbol/1524.
convert -size 10x10 xc:red xc:none +append testfx.png
x=5
y=5
convert testfx.png -format "%[fx:u.p{$x,$y}]" info:
convert: unable to parse expression `' @ error/fx.c/FxGetSymbol/1524.
Re: possible bug fx escape IM 6.6.6.5
A $ symbol is not a valid symbol in the FX language as defined here: http://www.imagemagick.org/script/fx.php. If you expect $x to be 5, it's not because the quotes prevent the FX expression from being evaluated by your shell.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: possible bug fx escape IM 6.6.6.5
magick wrote:A $ symbol is not a valid symbol in the FX language as defined here: http://www.imagemagick.org/script/fx.php. If you expect $x to be 5, it's not because the quotes prevent the FX expression from being evaluated by your shell.
This is very strange as it worked when I wrote my multicrop script (Jan 2010) and when Anthony modified it (Aug 2010). But it fails now with that error message. This is the actual code line in the multicrop script. I just simplified it for a simpler example of its failure.
testcolor=`convert $tmp/MASK.mpc -channel rgba -alpha on -format "%[fx:u.p{$x,$y}=="none"?0:1]" info:`
Is it possible something was changed since Aug that might have made the error trapping in the fx expressions now sensitive to the $ where it might have fortuitously parsed it before?
(I will have Anthony check his version of the script, also with the current release).
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: possible bug fx escape IM 6.6.6.5
See my previous comment above.
I believe that this line was probably incorrect in the script:
testcolor=`convert $tmp/MASK.mpc -channel rgba -alpha on -format "%[fx:u.p{$x,$y}=="none"?0:1]" info:`
and probably should have been
testcolor=`convert $tmp/MASK.mpc -channel rgba -alpha on -format "%[pixel:u.p{$x,$y}=="none"?0:1]" info:`
but even that does not work now for me.
I believe that this line was probably incorrect in the script:
testcolor=`convert $tmp/MASK.mpc -channel rgba -alpha on -format "%[fx:u.p{$x,$y}=="none"?0:1]" info:`
and probably should have been
testcolor=`convert $tmp/MASK.mpc -channel rgba -alpha on -format "%[pixel:u.p{$x,$y}=="none"?0:1]" info:`
but even that does not work now for me.
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: possible bug fx escape IM 6.6.6.5
Nothing to do with the '$' that is just a shell substitution. IM does not see them...magick wrote:A $ symbol is not a valid symbol in the FX language as defined here: http://www.imagemagick.org/script/fx.php. If you expect $x to be 5, it's not because the quotes prevent the FX expression from being evaluated by your shell.
Here I removed them...
Code: Select all
convert testfx.png -format "%[fx:u.p{5,5}]" info:
convert: unable to parse expression `' @ error/fx.c/FxGetSymbol/1524.
Code: Select all
convert testfx.png -format "%[pixel:u.p{5,5}]" info:
red
convert testfx.png -format "%[pixel:u.p{15,5}]" info:
none
-----------------
ASIDE to Fred. The expression should be %[fx:...] it is comparing value numbers!!!!
pixel does not compare strings can can't be used.
However that specific test
Code: Select all
testcolor=`convert $tmp/MASK.mpc -channel rgba -alpha on -format \
"%[pixel:u.p{$x,$y}=="none"?0:1]" info:`
if [ $testcolor -eq 1 ]; then
The test does ONE fx test on the one image, red channel only (-channels not used)
As such it is only testing if the pixel is red (1) or not (0) and doing so badly!
As such the simplified equivalent is simply...
Code: Select all
testcolor=`convert $tmp/MASK.mpc -format `"%[fx:u.p{$x,$y}]" info:`
if [ $testcolor -eq 1 ]; then
But if you want it working now change it to..
Code: Select all
testcolor=`convert $tmp/MASK.mpc -format `"%[pixel:u.p{$x,$y}]" info:`
if [ $testcolor = 'red' ]; then
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/
Re: possible bug fx escape IM 6.6.6.5
Ok, We'll get a patch into Subversion to fix this problem by sometime tomorrow.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: possible bug fx escape IM 6.6.6.5
Thanksmagick wrote:Ok, We'll get a patch into Subversion to fix this problem by sometime tomorrow.
I just tested:
testcolor=`convert testfx.png -format "%[fx:u.p{5,5}]" info:`
convert: unable to parse expression `' @ error/fx.c/FxGetSymbol/1524.
And now see that Anthony also had the same idea and test and got the same results above.
P.S.
Also see viewtopic.php?f=1&t=17577. He is trying to modify my multicrop script and it works for him. I asked him to identify the version of IM he is using in case that would make it easier to compare versions to see what has changed.
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: possible bug fx escape IM 6.6.6.5
Fred a fixed version of multi_crop is on my TEST server (limited access)
http://wraith.rcs.griffith.edu.au/~anth ... multi_crop
http://wraith.rcs.griffith.edu.au/~anth ... multi_crop
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: possible bug fx escape IM 6.6.6.5
anthony wrote:Fred a fixed version of multi_crop is on my TEST server (limited access)
http://wraith.rcs.griffith.edu.au/~anth ... multi_crop
I tried changing it from fx: to pixel: in my old syntax but that does not work right as it cannot (I now realize) do the == test.
testcolor=`convert testfx.png -format "%[pixel:u.p{5,5}==none?0:1]" info:`
echo "$testcolor"
red
So I see that you split the test into two parts. Clever! I should have thought of that. Thanks.
Re: possible bug fx escape IM 6.6.6.5
The bug you reported is fixed in in ImageMagick 6.6.6-6 beta available now. Thanks.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: possible bug fx escape IM 6.6.6.5
magick wrote:The bug you reported is fixed in in ImageMagick 6.6.6-6 beta available now. Thanks.
Thanks.
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: possible bug fx escape IM 6.6.6.5
Something still seems strange...
Has the definition changed, and you now get a greyscale value?
Definition from The Fx Special Effects Image Operator...
Of course actually specifically specifying the result of the red channel does produce
That should be, by definition, the red channel value, which should be 1.0, not 0.299convert testfx.png -format "%[fx:p{5,5}]" info:
0.299001
Has the definition changed, and you now get a greyscale value?
Definition from The Fx Special Effects Image Operator...
That last part specifies that red is the current channel setting when the single calculation for each image is performed. Debugging...For use with -format, the value-escape %[fx: ] is evaluated just once for each image in the current image sequence. As each image in the sequence is being evaluated, s and t successively refer to the current image and its index, while i and j are set to zero, and the current channel set to red (-channel is ignored).
What is 'channel unknown'!!!!convert testfx.png -format "%[fx:debug(p{5,5});p{5,5}]" info:
[0,0].unknown: p{5,5}=0.299001
0.299001
Of course actually specifically specifying the result of the red channel does produce
convert testfx.png -format "%[fx:p{5,5}.r]" info:
1
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/
Re: possible bug fx escape IM 6.6.6.5
We previously specified the red channel but there was a bug report which required we go from the red channel to the default channels. ChangeLog says:
- 2010-11-08 6.6.5-8 Cristy <quetzlzacatenango@image...>
* %[fx:mean] is the mean of the default channels (all but opacity) (reference
viewtopic.php?f=1&t=17432).
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: possible bug fx escape IM 6.6.6.5
I would have expected that %[fx:mean] be quite a different setting to %[fx:p{5,5}] with no relation to each other.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/
Re: possible bug fx escape IM 6.6.6.5
FX escape was an after-thought when the -fx option was designed. In addition, image info metadata is not available when its called from the properties realm so we had to implement it in a restrictive manner.