Home > HowTo > Fix Gallery3 to extract IPTC headlines and captions

Fix Gallery3 to extract IPTC headlines and captions

Gallery3, a web based photo album organizer, can extract the IPTC.Caption field of photos you import. This caption is then used to set the description of photos. However, this default behavior might not be what you would expect.

Introduction to Gallery and IPTC

Gallery is an open source web based photo album organizer. Gallery3 intends to replace the famous Gallery2. At the day of this writing, Gallery 3.0.2 is the latest release. Please find more information on the website.

The IPTC IIM is a standard defining a set of metadata directly saved in photo files and thus allowing the portability of photo information and the compatibility between photo software. More information on IPTC can be found in the resources.

Change Gallery’s default behavior

The current stable release (Gallery 3.0.2) only extracts the IPTC.Caption field of photos you import. However, the world is imperfect and photo software are not using the same IPTC fields to designate the title and the description of a photo. As far as I know, metadata fields should match:

IPTC.Headline or IPTC.ObjectName => Title
IPTC.Caption or IPTC.Comment => Description

As I share my Gallery3 space with other users (who are potentially using different software) and that we usually set only a title to pictures, I’d like Gallery to automatically find and set the photos titles. In other words:

if IPTC.Headline or IPTC.ObjectName is set
   photo.title = (IPTC.Headline or IPTC.ObjectName)
   if IPTC.Caption or IPTC.Comment is set
     photo.description = (IPTC.Caption or IPTC.Comment)
else if IPTC.Caption or IPTC.Comment is set
   photo.title = (IPTC.Caption or IPTC.Comment)

You’ll find my patch here. Enjoy it! I did not send this code to the official project because developers don’t seem to agree on IPTC tags use (see the tickets in resources).

Resources

About these ads
Categories: HowTo Tags: , ,
  1. Peter
    2012/10/25 at 18:14

    I am sure this is exactly what I need. My IPTC fields are jumbled (thanks to iView Media Pro!) and need to extract IPTC Contact so its also searchable from inside G3 along with IPTC Keyword.

    Does this code (with the obvious edit to address Contact field) make this happen?
    If so, how to install the .patch? (Sorry – I am new!)

    Any other help you can suggest for a fairly new user?

    Thanks anyway for proving that I am not the only one with such a challenge!

  2. Albin Kauffmann
    2012/11/01 at 16:29

    Hey!
    I’m still far from being an expert with Gallery, but I think you should be able to extract your IPTC contacts but using the same principle. Just set the correction filed in the structure pointed to by $item.

    This patch is applied with the following command :
    $ cd /path/to/your/gallery3
    $ patch -p1 < /path/to/gallery-3.0.2-exif.patch

    I hope this helps :)

  3. Albin Kauffmann
    2012/11/01 at 16:31

    Oh, and note that the patch style works with the last version of gallery (3.0.4).

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: