Some image magick

I recently started an epic photo album project chronicling our family life from the last decade. It included putting together a system that allows me to quickly pick and print photos on a monthly basis so that I don't ever again end up with years' worth of curation work to tackle.

I'm a sucker for laying stuff out neatly, and for once got a chance to do it in the physical world. I thought it would be nice to have photos appear in various different sizes, so each album page is a bit like a collage of bigger “key moments”, and smaller, peripheral “vibe/atmosphere moments”.

Unfortunately there are no local print shops that print photos smaller than the standard 10x15cm. For real?!

So, here are two tiny imagemagick scripts to take a bunch of photos in the working directory and output collages in a 2x2 or 2x1 grid (which I then print in the standard 10x15 format).

#!/bin/bash
# Make all landscape images portrait
echo "MAKING ALL IMAGES PORTRAIT"
mogrify -monitor -rotate "90>" *.{jpg,JPG}
# Resize each image to exactly fit 1/2 tile of 10x15 print
echo "RESIZING ALL IMAGES TO FIT 2/3 aspect ratio"
convert -monitor *.{jpg,JPG} -resize 1902x2535^ -gravity center -extent 1902x2535 resized_%d.jpg
# Make montages dir if doesn't exist
mkdir -p montages
# Generate 2x1 montages of all the resized images
echo "Generating 2x1 montages"
montage -monitor resized_*.jpg -geometry 1902x2535^+0+0 -tile 2x1 montages/montage_%d.jpg
view raw montage-half hosted with ❤ by GitHub
#!/bin/bash
# Make all portrait images landscape
echo "MAKING ALL IMAGES LANDSCAPE"
mogrify -monitor -rotate "90<" *.{jpg,JPG}
# Resize each image to exactly fit 1/4 square of 10x15 print
echo "RESIZING ALL IMAGES TO FIT 3/2 aspect ratio"
convert -monitor *.{jpg,JPG} -resize 1902x1267.5^ -gravity center -extent 1902x1267.5 resized_%d.jpg
# Make montages dir if doesn't exist
mkdir -p montages
# Generate 2x2 montages of all the resized images
echo "Generating 2x2 montages"
montage -monitor resized_*.jpg -geometry 1902x1267.5^+0+0 -tile 2x2 montages/montage_%d.jpg
view raw montage-quarter hosted with ❤ by GitHub

It turned out to be trickier than I imagined, because you need to account for photos being landscape or portrait in order to correctly slot them into a quarter or a half of the standard photo size.

The sizes for a quarter (1902x1267.5) and half (1902x2535) are kind of arbitrary, and chosen to be big enough to look good when printed in the 10x15cm format.

Example result of running `montage-half` in a folder with five Unsplash photos
Example result of running montage-half in a folder with five Unsplash photos

Now, after sorting a handful of photos into folders based on whether they should be a half or a quarter of the standard, I just run the two scripts and end up with a collection of photos in the same size, some collages, some not, ready for printing in batch.

Yes, I do have to manually cut them after printing. Yes, I did buy a guillotine cutter.

About Elise Hein

I’m a design engineer at Griffin. Previously, I helped build products for healthcare research at Ctrl Group, worked on personal digital branding at MOO, and researched development practices at UCL for my master’s degree in HCI.

I live in Tallinn, Estonia, where I’m raising a preschooler and a toddler with @karlsutt.
Find me on GitHub and LinkedIn. Follow me on Twitter (but know that I’m still building up to my first Tweet). Email me at elise@elisehe.in.