Very long command line

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
mzorova

Very long command line

Post by mzorova »

Is there any way to use convert and ask it to take all the parameters from a file? I have a 100 files that I would like to append (in a specified order) to one another to create a very large image, and then crop and resize the result, etc.

Or is the only way to do it to split it up into multiple convert commands?
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Very long command line

Post by magick »

Some of convert's options can be placed in a file and you can also use wildcards to shorten the command line length. You could say, for example,
  • convert "*.jpg" image.png
You need the quotes so the shell does not interpret the wildcard character, instead ImageMagick interprets it.
mzorova

Re: Very long command line

Post by mzorova »

Since the order is important the globbing will not work unfortunately. Outside of draw parameters is there anything else that can be in a file? If yes, where can I find the list of the ones that are?
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Very long command line

Post by anthony »

You can also pipeline the output of separate commands into one IM.

For example

Code: Select all

   for ...loop thru files in order wanted....
       convert image ...options... miff:-
   done |  montage miff:- ...montage_options... image_page%02d.png
The convert commands can do what ever individual image process you need, in the image order you need. The loop output will be a stream of images, one after the other that a single command will read as a single image sequence.

You can even do your montage labeling in the convert command, rather than a global label in the montage.

It is one of the lesser used features of the Magick Image File Format (MIFF). I have used it in scripts to process a recursive directorys of images.

WARNING: the convert should also do the montage size reduction (thumbnailing) to reduce the size of the images being passed to montage (or whatever further processing you are doing).
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply