2008-06-17 ImageMagick’s Montage

Assume you have n directories, each containing 7 pictures. You want to somehow assemble them into a single image. ImageMagick’s Montage does just that – “create a composite image by combining several separate images”. Here’s a Makefile for you to use:

ImageMagick

%.jpg:
	d=`basename $@ .jpg`; echo $d; montage $d/* -background black \
	-tile 4x2 -geometry 236x364+10+10 $d.jpg

Nice. It took me a while to realize that `-size`, `-resize`, `-page`, and all the other options that take a geometry parameter are the wrong thing. The `-geometry` argument is listed in the manual as “preferred tile and border sizes” – somewhow it never occured to me that this is just what I needed. Instead of specifying the size of the end result (1024 × 768) I specified tiling, tile dimensions, and the border – and get the same effect.

My build of the tool – MacPorts? – doesn’t seem to know about any fonts, by the way. That’s why I can’t use the `-draw` argument to place text on the montage. Oh well, it turns out that I don’t want any text anyway. `convert -list type` produces an empty list.

MacPorts

​#Software