How to pass a list of files to ImageMagick's montage?

In the newer versions of ImagMagick (i.e >v6.5.2-1) @ operator can be used like this:

montage @list.txt -geometry +0+0 -tile 17x15 all.jpg

It looks like montage does not support a "file with filenames" argument.

Edit: @Devdatta found the correct syntax (see also here): @filenames.txt. So, the method below should only be necessary for very old versions of the ImageMagick tools.


But if you are using Linux or a Unix-like system, you can replace the filename argument(s) with the output of a command. This way, you can use your file with the ordered filenames:

montage `cat filenames.txt` -geometry +0+0 -tile 17x15 all.jpg

(Please note the backticks around the cat command.)

Line breaks between filenames in filename.txt do no harm to the command invocation. And you may even use wildcards in filename.txt, as command substitution precedes filename expansion.

Of course, you could also rename the source files beforehand to yield the order wanted.