ImageMagick Thumbnails and Contact Sheets

March 30, 2009

Update (2010-06-14)
Thanks to Glenn Turnbull I’ve fixed a bug where the last contact sheet would not be created when the number of photos is evenly divisible by the contact sheet size.

Additionally, this script and others will now be kept updated at http://github.com/jmhobbs/helper-scripts

Update (2012-04-10)
Phillip Vuchetich wrote a neat script for making composite 4×6 out of wallet sized images, which he has allowed me to post about here.

Wow, long time no post. Darcy and I got a digital camera about a week ago, a Nikon D90. We haven’t really had a chance to put it through it’s paces, but we’ve taken a few pictures around the house to play with it.

At about 3mb each (JPEG’s) the images are really slow to preview in Konqueror. I decided it would be better to be able to download all the photos from the card, then run a script to make my thumbnails. That way I wouldn’t have to wait around while I was viewing photos, instead I could just wait once at the beginning of the process.

My resulting script may have some holes, but it works well for me on Sidux. It takes all of the images in the current directory and makes 600×600 base thumbnails into a directory called “thumb” then uses those to make 12 image contact sheets into a directory called “contact”.

real user sys
resize 0m43.478s 0m40.625s 0m2.525s
scale 0m25.449s 0m22.975s 0m2.236s
sample 0m18.362s 0m15.983s 0m2.211s
Script times for 16 JPEG images at 3Mb each
To 600×600 thumbnails and 200×200 contact sheet frames.

Your results will vary, but I ran it with three different scaling types (resize, scale, sample). I’m fine with the output from the fastest one (sample) but you can do as you please. I didn’t add command line options because I wanted to have consistent sizes and qualities every time I use it.


Side By Side Resize Method Comparison
Click For Fullsize

Sample Contact Sheet
Click For Full Size

It keeps you updated so you know it hasn’t stalled, here is a sample run.

And here it is. Feel free to comment your changes!

Categories: Geek
Tags: , , , ,

Comments

  1. Thanks a lot! You saved me the time and effort. I’m very happy with my contact sheet.

  2. Phillip Vuchetich says:

    Thanks for this script – I plan to tweak the script setting slightly to make it easier to montage 4 photos into a single image file so we can have a 4×6 printed with 4 different wallets for scrapbooking.

    Why? All of the local photo printing companies will only print a 4×6 with 4 identical wallet photos, and charge about 5-10 times the price of a 4×6…and we only need one of the 4 prints anyway. We’ve printed wallets on an inkjet, but the store photos look a little better.

  3. John Hobbs says:

    I’ve done the same trick myself in the past, I made a set of magnets for a Christmas present and I just arranged all the photos on one 4×6. Hope it works out for you!

  4. […] > ${CONTACTDIR}/${PAGE}.jpg fi Categories: Geek Tags: BASH, Programming, ScriptRelated Posts2009-03-30ImageMagick Thumbnails and Contact Sheets 2007-05-24Disappointed In SimpleXML 2007-11-30HowTo’s 2006-10-02Handling Forms With PHP […]

  5. Kyle Skrinak says:

    I love this, fits the bill, and it is just what I needed without having to download some huge binary. Thanks!

  6. […] that you have ImageMagick up and running, visit this site: http://www.velvetcache.org/2009/03/30/imagemagick-thumbnails-and-contact-sheets and save out the bash script there as something like “thumbnail.sh”. One way to do that is to […]

Leave A Comment

Your email will not be published.