I do most of my photo editing, and picture organizing, in Adobe Photoshop Lightroom. Since I now how over forty thousand pictures from miscellanous events and concerts, and everything else, I like to tag people in pictures, so I can find them again, easily, if anyone asks.
Picasa 3 came with a face detection feature, which scans through all the pictures in your library, and tries to find people with some fancy algorithm. You can then add a name to the face, and easily see all pictures you have with that person in it. Almost. It doesn’t find a face in every situation, so it is not perfect, but it is a good start.
However, Picasa does not store the data about people in the files metadata. You can trick it in there, but since I work with RAW files (NEF), and Picasa doesn’t use XMP for metadata, that is not a good way to do it.
With a bit of reasearch, I found out that in every directory where there are pictures with found faces, Picasa stores a file ( .picasa.ini) that contains information about what picture file contains faces, where in the file there is a face, and what contact that is hooked up to. Picasa also stores an XML file with all the contacts in them.
Using that I wrote a small Perl-script that gets all the contacts out of the XML-file, scans through the current directory for the .picasa.ini file, matches contacts with that, and stores the new data in XML metadata with the file.
Before using the script, you need to change some variables to point to the right contacts file and such. You also need the XML library for Perl, and the Perl Exiftool-library installed.
The script has only been tested in Windows 7, with Cygwin.
The procedure goes as follow:
- In Picasa, do the face tagging. Check the picasa website for help on that.
- In Lightroom, make sure you select all the pictures you want to update, and write all the metadata to files. That’s from the metadata menu.
- Go to the folder you have some pictures with people in it and run the Perl script.
- Open Lightroom again, select the pictures, and choose to read metadata from files.
It seems to be working okay now, but I take no responsibility for damages it may do to your pictures if you try it. Make sure you have a backup first!
To run the script recursively I use the command:
find . -name \.picasa\.ini -execdir ~/scriptlocation/faceextract.pl \;
The script is available on github