MC's journal

Pungenday, the 58 day of Chaos in the YOLD 3182

Apple Photos and photo captions

For a while I've been using an iPhone as my main camera. When importing photos from the phone with Apple Photos it's possible to edit photos, tag them and add captions to them before exporting them to a directory where I can generate web galleries with simgal.

I'm sad to say it, but adding captions to photos in Apple Photos is much easier than doing it with Emacs, as I usually do.

The comments added by Apple Photos are not the familiar JFIF comments, however, but is instead the "caption" field in IPTC data. Fortunately for me, jhead knows how to parse IPTC as well. It says something like:

...
======= IPTC data: =======
City          : G
Record vers.  : 2
Object Name   : totoro
Caption       : totoro on kitchen floor

which I can easily get into simgal with:

exifdata=`jhead $current |awk '/^Date.*/ { print $3,$4 } ; /^Comment/ { print substr($0, index($0,$3)) } ; /^Caption/ { print substr($0, index($0,$3)) }'`

which I just then dump unceremoniously to the web page.


Written by MC using Emacs and friends.