Search code examples
cmdimagemagick

Imagemagick: How do "-define" with several parameters in it?


When using a batch-file with IM, I have a need of defining several parameters for "-define". My original code-line is:

magick "inputfile" -colorspace RGB -filter Lanczos -define filter:blur=.9891028367558475 -distort Resize 1072x -quality 90 -colorspace sRGB -verbose "output.jpg"

.. which works as desired. Now I need to add the following to the line:

-define jpeg:dct-method=float

However, as can be seen above, I have already initiated and occupied the -define parameter. So how can ppl use several parameters under the -define command? What is the proper usage/syntax?

I also use FFMPEG for videos, and FFMPEG accepts combining several parameters for one command by simply using a comma "," between the parameters. Applying this on Imagemagick, just to test, will be this:

magick "inputfile" -colorspace RGB -filter Lanczos -define jpeg:dct-method=float,filter:blur=.9891028367558475 -distort Resize 1072x -quality 90 -colorspace sRGB -verbose "output.jpg"

Imagemagick doesn't protest when I run this. However Imagemagick is unfortunately unusually silent about however it accepts commands or not. FFMPEG on the other hand is very outspoken with this. ImageMagick also does not protest if I use double "-define" commands, like this:

magick "inputfile" -colorspace RGB -filter Lanczos -define jpeg:dct-method=float -define filter:blur=.9891028367558475 -distort Resize 1072x -quality 90 -colorspace sRGB -verbose "output.jpg"

So I'm not sure if I trust that either using a comma-sign or double commands works, or not. I have been scanning Imagemagicks vast helpfiles for some time now, and I find no mentioning of using two parameters within one command, or to use the same command twice.

Hoping for some more experienced opinions/directions.

thx


Solution

  • You can have multiple -define parameters without issues. Each one just sets an internal variable within ImageMagick. You can check with:

    magick -debug all -define xxx -define yyy ...