This little problem hit me at the weekend, it turns out the fix is trivial but it took me a while reading through the docs to get things working in a way I was completely happy with.

I use the IPTC Headline field in my image management software for the title of the image, this has always worked ok for me and the Flickr upload I use works fine with it. But just recently I have started to use the excellent NextGEN gallery plugin for WordPress. This seems to use the XMP field Title instead of IPTC Headline. I’m not up for changing what I use in the photo management software so I figured I must be able to write one field into another in the meta data.

It turns out exiftool can now manipulate a lot more than just exif data! I don’t think I’ve had any reason to use it to probably 5 years or more. It can easily copy one field to another within the same image, the command line I use is:

exiftool -tagsfromfile %f.jpg -ext jpg -"IPTC:headline>XMP:title" \
  -overwrite_original <directory>;

This command tells exiftool to read the tags from all the images with the jpg extension in the named directory, and then replace the XMP:title tag with the contents of IPTC:headline. The final option “-overwrite_original" dispenses with the backup copies exiftool normally creates.  You might not want to use this, but in my workflow the images I’m processing with this are exports of the originals, not the originals. So if anything screws up I simply have to export them again.

I’m terrible at remembering syntax, so I’ve wrapped this command in a quick bash script which is below incase it is of any use.

#!/bin/bash

[ -z $1 ] && echo "Must provide a directory name, . is acceptable" && exit 1
[ ! -d $1 ] && echo "$1 is not a directory" && exit 1

# Run exiftool and copy IPTC Headline to XMP Title for everything in given dir
exiftool -tagsfromfile %f.jpg -ext jpg -"IPTC:headline>XMP:title" \
  -overwrite_original $1