Scripted workflow for preparing images

2004-09-29 2-minute read

I’ve finally written a very small shell script to prepare my Digital Rebel photos for web posting. I used to do this manually, but that’s just silly. I shoot in fine-resolution JPEG, which results in images 3072x2048 (landscape) - pretty huge for a web gallery. I’ve found that shrinking them down to 2048x1365 results in a decent sized file. In addition, Coppermine Gallery can create good looking thumbnails from these images - if I shrink the images too much, the thumbnails turn to crap. Because I’m too busy, I don’t spend much time editing in The Gimp. If I screw it up badly when I click the shutter, I probably won’t bother fixing it after the fact. I could shoot in Canon Raw, but the files are too huge. I’ve already bought a tape drive for backups - I’d rather not buy a tape loader. The process involves two steps:

  1. resize for the web
  2. rotate if not already in landscape orientation

The images are resized using convert from the ImageMagick package. Using the following syntax, I am able to resize to no side longer than 2048 pixels:

convert -resize ‘2048x2048>’ origfile.jpg newfile.jpg

In the second step, I use jhead to rotate based on the EXIF Orientation tag. If the image is not already set to normal orientation (orientation = 1), the image is rotated by jpegtran. The syntax is:

jhead -autorot newfile.jpg

The end result is an image no longer than 2048 pixels on a side, and properly oriented.