Sunday, August 29, 2010

Post-Trip Photo Post-Processing

After returning from vacation, I wanted to develop a flow for post-processing my photos. It didn't go very well, but this ugly process got me there.

1. Tweak photos and add captions in Picasa
This includes minor color and contrast adjustments, cropping, and adding captions. Nothing too tricky here.

2. Add Borders and Copyright information in Gimp
This is where it got tricky. I modified the batch processing plug-in for Gimp called PhotoLab to add a border that I liked better than the original. I also added copyright information that is written on the border. The biggest hurdle though was Gimp itself -- the built-in jpg save functions lose all the metadata, including the photo-taken timestamp that I use to sort the photos and the captions that I added in Picasa.
To rectify this problem, I called the executable version of exiftools from within the python script. A better way would have been to code it directly into the plug-in, but I ran out of patience for that. Hopefully the upcoming Gimp version 2.8 will fix this problem.

It is not particularly robust, but these items are essential:
The script can be found here:  http://registry.gimp.org/node/24708

3. Rename the Photos, in almost chronological order.
I wanted to rename my photos in the order that I wanted them to appear in the album. This is almost chronological order, but I added a cover image and map (the original motivation came from having images from two cameras that had unique numbering schemes. There are probably a dozen better ways to do this, but I was burnt-out on this project by now. I did this by
  1. Copying the two images I wanted first to a directory named "renamed_images" and manually editing their names.
  2. Ran the following exiftools command: exiftool -fileOrder CreateDate -filename=Norway_Aug2010%-c.jpg -directory=renamed_images/%d .
The command moves the files, adding a copy number to the end.

4. Credits
1.  The "base" of the script was batch processing for adding borders and title information from the PhotoLab suite of Gimp tools.  http://registry.gimp.org/node/157

List of changes:
  • Changed the "title" feature to be a copyright feature
  • Placed the copyright information on the border (size scales with border so it always fits).
  • Replaced the border with one I liked better (see #2 below)
  • Used exiftool to preserve metadata (see #3 below)
  • Note:  I have not renamed the script from the PhotoLab original.
  • Note:  The script is now limited to JPG images (mostly to preserve metadata)

2.  I replaced the border with a modified version of the border implemented in the two_color_borders.py script.  http://registry.gimp.org/node/24635
  • Changed the script so that the border overlays the edges of the current image in order to maintain the original aspect ratio.  A quick code change can switch it back (I meant to make this an option, but ran out of time).
3.  In order to "preserve" metadata, I used ExifTool (http://www.sno.phy.queensu.ca/~phil/exiftool/) to copy the metadata from the original JPG to the new JPG.
  • Note:  ExifTool.exe must reside on your path.