Page 1 of 1

[RESOLVED] Enhancement Request

Posted: 2018-01-19T15:57:07-07:00
by fmw42
The following command works in IM 7.0.7.21 Q16 Mac OSX Sierra

Code: Select all

magick logo: -evaluate multiply "%[fx:maxima]" tmp.png
Since the maximum value in logo: is white, "%[fx:maxima]" will equal 1 and tmp.png will look the same as logo:

But this fails trying to use -set option with percent escapes for the argument of -evaluate:

Code: Select all

magick logo: -set option:M "%[fx:maxima]" -evaluate multiply "%[M]" tmp.png
magick: invalid argument for option '-evaluate' 'logo:' at CLI arg 5 @ error/operation.c/CLISimpleOperatorImage/2328

If it is not too hard, would it be possible to make evaluate arguments be sensitive to -set option:arument "%[fx:...]" percent escapes.

Re: Enhancement Request

Posted: 2018-01-19T18:08:34-07:00
by GeeMack
fmw42 wrote: 2018-01-19T15:57:07-07:00But this fails trying to use -set option with percent escapes for the argument of -evaluate:

Code: Select all

magick logo: -set option:M "%[fx:maxima]" -evaluate multiply "%[M]" tmp.png
magick: invalid argument for option '-evaluate' 'logo:' at CLI arg 5 @ error/operation.c/CLISimpleOperatorImage/2328

If it is not too hard, would it be possible to make evaluate arguments be sensitive to -set option:arument "%[fx:...]" percent escapes.
Using IM 7.0.7-21 on Windows 10 I can get that command to work without the error if I make the "option:var" with more than a single character "var". On this page it shows the upper case "%M" is designated as the symbol for "Magick filename (original file exactly as given, including read mods)". Maybe it can't be overwritten.

This command works as I'd expect...

Code: Select all

magick logo: -set option:foo "%[fx:maxima*0.9]" -evaluate multiply "%[foo]" tmp.png

Re: Enhancement Request

Posted: 2018-01-19T18:43:30-07:00
by magick
See https://www.imagemagick.org/Usage/trans ... ex.html#fx. It says "Due the simple tokenization handling used by "-fx", variable names can only consist of letters, and must not contain numbers. Also as a lot of single letters are used for internal variables accessing image information, it is recommended that variable names be at least two letters long. As such I use 'xx' and 'yy' rather than just 'x' or 'y'."

Re: Enhancement Request

Posted: 2018-01-19T19:30:47-07:00
by fmw42
DOH! Thanks. I forgot about the single letter issue. This works fine.

Code: Select all

magick logo: -set option:MM "%[fx:maxima]" -evaluate multiply "%[MM]" tmp.png