Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Copy ITPC UserComments to Captions for iPhoto '08 use Apps
I sometimes travel with an Eee PC 901 "netbook" when I want something lighter than my 12" PowerBook, but more capable than my iPod Touch. F-Spot, the photo management progarm I use on the Eee PC, can embed photo comments in EXIF.UserComment tags in the JPEG files, if you add the Exiflow plug-in. However, iPhoto'08 (version 7.1.5) does not copy those comments when the photos are imported. I discovered, though, that iPhoto will copy ITPC Caption tags into its Description field.

I wrote a bash script which reads the content of EXIF UserComment tags in JPEG files, and inserts that content into ITPC Caption tags, which will then be read by iPhoto when the photos are imported. Here's the code:
#! /bin/bash

# read EXIF UserComment in each jpg and write it to ITPC Caption
#
# Usage: exif_comments2iptc *.jpg
# or: exif_comments2iptc file_name1.jpg file_name2.jpg ...
#
# exiv2 must be present on the machine where the script is run
# http://www.exiv2.org/
# http://pdb.finkproject.org/pdb/package.php/exiv2
# http://trac.macports.org/browser/trunk/dports/graphics/exiv2/Portfile
#
# script by Kevin Horton - released into the public domain

if [[ $# -lt 1 ]]; then
  echo "Usage: exif_comments2iptc one or more jpg file names ..."
  exit 1
fi

pattern="Exif comment    : (.+)"

for file_name
  do
    if [[ `exiv2 $file_name` =~ $pattern ]]; then
      comment=${BASH_REMATCH[1]}
      echo "File: $file_name has comment: $comment"
      `exiv2 -k -M"add Iptc.Application2.Caption ${BASH_REMATCH[1]}" $file_name`
     else
       echo "No comment in $file_name"
     fi
  done
My workflow is to export the photos to a folder on my Eee PC, then run the script at the command line on the Eee PC. Then I move the files to the Mac and import the photos. Alternatively, the script could be run on the Mac, possibly as part of an AppleScript or Automator action that ran the script then imported the photos into iPhoto.

Exiv2 must be installed on the machine running the scripts. On the Mac, this can be done using Fink or MacPorts.
    •    
  • Currently 1.25 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (4 votes cast)
 
[4,544 views]  

Copy ITPC UserComments to Captions for iPhoto '08 use | 2 comments | Create New Account
Click here to return to the 'Copy ITPC UserComments to Captions for iPhoto '08 use' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Copy ITPC UserComments to Captions for iPhoto '08 use
Authored by: geert2705 on Jun 17, '09 11:08:52PM
I use (what I consider to be) the excellent exifTool to do this kind of thing. More complete, regular updates.

http://www.sno.phy.queensu.ca/~phil/exiftool/



[ Reply to This | # ]
Copy ITPC UserComments to Captions for iPhoto '08 use
Authored by: rv8 on Jun 18, '09 04:05:56AM

A sharp-eyed reader pointed out that I mistyped - the text should refer to "IPTC", not "IPTC". The script is OK - I just got dysdexic when I wrote up the hint.

---
Kevin Horton



[ Reply to This | # ]