Combining images using Montage

21 Jun 2017

When working with scripts that generate plots, there is occasionally a (possible contrived) need to place these plots side by side to compare the results (say, different bar graphs) and lay them out in a nice grid like fashion. Of course, the CLI gods forbid doing this using a mouse.

Now, I came across imagemagick, a FOSS suite for image manipulation. It comes with a tool called montage, which lets you organize images in a specified layout (in my case, I wated a nice 3x3 grid). It even lets you apply formatted labels to each image (so you know where each one came from, because you were too lazy when you wrote those scripts to actually do that)

$ montage -label %f \<input files\> -font /usr/share/fonts/TTF/Ubuntu-BI.ttf -tile 3x3 -pointsize 20 -geometry +20+20 out.png

Broken down in the worst possible way (because this is off the top of my head)

And this produces out.png with a nice little grid and filenames as labels.