Page 1 of 1

Cannot execute commands containing -fx

Posted: 2018-10-23T17:23:32-07:00
by hellocatfood
I'm attempting to use the fx command on an image. In particular I'm attempting to run the example from here: http://www.imagemagick.org/Usage/quantize/#diy_symbols

Input images:
[*] eyes.gif http://www.imagemagick.org/Usage/quantize/eyes.gif
[*] dpat_symbols.gif http://www.imagemagick.org/Usage/quanti ... ymbols.gif

Code: Select all

montage dpat_symbols.gif   -geometry +5+0 \
		  -tile x1 -background none -mattecolor blue  -frame 3 \
		  dpat_syms_images.gif
  convert eyes.gif -alpha off -colorspace sRGB -grayscale Average \
		  +matte -scale 1600% -negate  \
		  dpat_symbols.gif -virtual-pixel tile -fx 'u[floor(15.9999*u)+1]' \
		  eyes_syms.gif
When I run it I get the following error

Code: Select all

error: convert: no such image `u[floor(15.9999*u)+1]' @ error/fx.c/FxGetSymbol/1400.
It seems like ImageMagick is replacing the first ' with a ` (backtick) and it's trying to treat it as an image. I've tried this with some other commands using fx and I'm getting the same result.

I'm running ImageMagick 7.0.8-14 on Ubuntu 18.10.

Re: Cannot execute commands containing -fx

Posted: 2018-10-23T18:13:12-07:00
by snibgo
The inputs don't seem to be given on your link, so please post links to the files you are using.

Re: Cannot execute commands containing -fx

Posted: 2018-10-24T02:04:58-07:00
by hellocatfood
snibgo wrote:
2018-10-23T18:13:12-07:00
The inputs don't seem to be given on your link, so please post links to the files you are using.
Post has been edited to link to input images.

Re: Cannot execute commands containing -fx

Posted: 2018-10-24T04:32:44-07:00
by snibgo
That second command works fine for me with IM v6.9.9-50 with bash on Cygwin under Windows 8.1.

With IM v7.0.7-28, replacing "convert" with "magick convert", it works fine.

With IM v7.0.7-28, replacing "convert" with "magick", it works fine although I get a warning that "+matte" is deprecated.

In "-fx", the expression "u[N]" where N is an integer refers to an image in the sequence, so a problem in there might result in a "no such image" error. But I copy-pasted your command, and used the file you linked to.

Sorry, I can't explain the error you get. Perhaps there is a recent bug in your 7.0.8-14.

Re: Cannot execute commands containing -fx

Posted: 2018-11-08T15:10:37-07:00
by hellocatfood
Just tried this on a fresh install of Ubuntu 18.10 and still the problem occurs. I really can't tell where the problem lies.

Re: Cannot execute commands containing -fx

Posted: 2018-11-08T16:14:08-07:00
by dlemstra
I cannot reproduce your issue with the latest version of ImageMagick 7 on Windows. What happens when you use double quotes instead of single quotes?

Re: Cannot execute commands containing -fx

Posted: 2018-11-08T17:14:14-07:00
by hellocatfood
dlemstra wrote:
2018-11-08T16:14:08-07:00
I cannot reproduce your issue with the latest version of ImageMagick 7 on Windows. What happens when you use double quotes instead of single quotes?
Still the same error. I'm guessing this error is specific to Linux/Ubuntu Linux but I can't figure out what could be causing it.

Re: Cannot execute commands containing -fx

Posted: 2018-11-10T13:12:24-07:00
by hellocatfood
I've tried a few things and it seems that, at least on Linux, the issue with that one specific command is the "+1". If I run the following command it seems to work (or at least not crash).

Code: Select all

'u[floor(15.9999*u)]'
Still no idea why this exists on Ubuntu/Linux and not other OS's.

Re: Cannot execute commands containing -fx

Posted: 2018-11-17T08:47:33-07:00
by hellocatfood
So, I worked out what was the "problem". Since either a later version of Imagemagick 6 and/or Imagemagick 7 the code is more strict. in `'u[floor(15.9999*u)+1]'` the 15.9999 refers to the number of input images to use for the repeating tiles, which in dpat_symbols.gif is 16. If the number of input images is less than this number the script fails.

In previous versions this was allowed but since the later versions of Imagemagick it isn't, which I guess is a good thing.