ImageMagick ships the montage command as a way of creating composite images. For example (stolen from their site):


For libro-finito, I'm interested in stitching several images together on a grid to try and replicate something like the image Goodreads' year in books:


Essentially books tiled together with some appearing larger according to some heuristic (rating would be a good choice!).

Let's Start 🔨

Given some images, if we want three images per row, something like:

montage -geometry +0+0 starship-troopers.jpeg a-spell-for-a-chameleon-l.jpeg the-caves-of-steel.jpeg the-count-of-monte-cristo.jpeg a-wizard-of-earthsea.jpeg tmp.jpeg

Gives us:


ImageMagick has done its best to set the distance between images as zero, but this appears to have lead to inconsitency of column sizes. Generally different sized images aren't going to work too nicely with one another.

In the example above I've made it so that larger images are 4x the size of the smaller ones (ie 2x width and 2x height). A "nice" tiling is possible if we make all of the images the same size… by splitting up the larger images into quarters.

We split larger images into four smaller ones, taking care that we always align the bottom two images on the same columns below the top two images. I've offloaded this tiling specification of our "split" images to a script.

But does this work? Yes!