Cannot execute commands containing -fx

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
hellocatfood
Posts: 44
Joined: 2010-01-01T13:29:41-07:00
Authentication code: 8675309

Cannot execute commands containing -fx

Post 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.
Last edited by hellocatfood on 2018-10-24T02:04:24-07:00, edited 2 times in total.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Cannot execute commands containing -fx

Post by snibgo »

The inputs don't seem to be given on your link, so please post links to the files you are using.
snibgo's IM pages: im.snibgo.com
User avatar
hellocatfood
Posts: 44
Joined: 2010-01-01T13:29:41-07:00
Authentication code: 8675309

Re: Cannot execute commands containing -fx

Post 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.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Cannot execute commands containing -fx

Post 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.
snibgo's IM pages: im.snibgo.com
User avatar
hellocatfood
Posts: 44
Joined: 2010-01-01T13:29:41-07:00
Authentication code: 8675309

Re: Cannot execute commands containing -fx

Post 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.
User avatar
dlemstra
Posts: 1570
Joined: 2013-05-04T15:28:54-07:00
Authentication code: 6789
Contact:

Re: Cannot execute commands containing -fx

Post 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?
.NET + ImageMagick = Magick.NET https://github.com/dlemstra/Magick.NET, @MagickNET, Donate
User avatar
hellocatfood
Posts: 44
Joined: 2010-01-01T13:29:41-07:00
Authentication code: 8675309

Re: Cannot execute commands containing -fx

Post 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.
User avatar
hellocatfood
Posts: 44
Joined: 2010-01-01T13:29:41-07:00
Authentication code: 8675309

Re: Cannot execute commands containing -fx

Post 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.
User avatar
hellocatfood
Posts: 44
Joined: 2010-01-01T13:29:41-07:00
Authentication code: 8675309

Re: Cannot execute commands containing -fx

Post 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.
Post Reply