[RESOLVED] Enhancement Request

Questions and postings pertaining to the development of ImageMagick, feature enhancements, and ImageMagick internals. ImageMagick source code and algorithms are discussed here. Usage questions which are too arcane for the normal user list should also be posted here.
Post Reply
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

[RESOLVED] Enhancement Request

Post 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.
User avatar
GeeMack
Posts: 718
Joined: 2015-12-01T22:09:46-07:00
Authentication code: 1151
Location: Central Illinois, USA

Re: Enhancement Request

Post 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
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Enhancement Request

Post 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'."
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Enhancement Request

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