Thursday 26 April 2012

How to make Picasa name tags be indexed by Spotlight

I recently rediscovered Picasa and am impressed with its new features - considering it is free. Thanks Google! Picasa is a photo organising and touch-up software and is available for Windows, Mac and Linux (with Wine). However, you still need to be a bit of a geek in order to not get trapped. 

What I particularly like about it is that it leaves all photos in the place I put them and does not store copies in its own folder - as iPhoto does. This makes it easier to share my photos between computers, be able to mange the photos with other software at the same time and allow me to keep the photos in a file structure that is sensible to me - namely in folders by the year in which they were taken and then in a folder for the location or trip to which they belong. Importantly, it has a small footprint on your RAM.

tagging...

What brings me to write about Picasa is its nifty naming and tagging features. Thanks to demand, if you choose so in the preferences, you can now save the names of people to the EXIF data of each JPEG. As I described in my last post, I like to be able to use my operating system to quickly search/display photos and produce slide shows based on the tags they contain. Correctly tagging all of your photos that you have accumulated over your life - if like me you have gone to the trouble of scanning them - can take an equally endless time. The Picasa facial recognition tool makes this task so much easier, if not fun. 

It sometimes comes up with amusing suggestions, particularly if it sees a face on a train or in a plate of food, but really its down side is that it does not recognise your pets and, particularly, people who are not facing the camera! It also tends to miss some people that are facing the camera. And don't bother scanning folders that have many photos with strangers in the background or you'll be up all night ignoring/hiding their faces!

When you first set Picasa up you'll be bullied into agreeing that it scans for photos in a couple of default locations. I forget if there is a way out of this, but I recommend going afterwards to Tools>Folder Manager and selecting only those folders you actually want it to manage. If you would like it to save the tagged people to the EXIF data of your photos (JPEGs only I think), go to Preferences and the Name Tags tab and select "Store name tags in photo". Note, that even if you don't select this option, if you assign any tags or comments to a photo, Picasa will anyway leave its print in the EXIF data of the photo and a unique ID number, which helps it link the photos to its database.

indexing...

Picasa stores the name tags under a tag name that is not indexed by Spotlight or, probably, the Windows indexer. Thus, it still traps you into using their software so that you are more inclined to upload your photos to share on their server. My solution to this, as before, is to duplicate the name tags to OpenMeta and Windows format tags. And here is my Bash script, that does just that, on my Mac. 


picasa2tags.sh

[edit: original code with the typo has been replaced with the following github snippet]


To use the script, copy and past it into a text editor, save it as picasa2tags.sh where you saved the other script, also make this script executable by going to the location in Terminal and entering chmod +x picasa2tags.sh and running the script as, e.g, picasa2tags.sh -r DirName

Warnings
  1. Make sure you have backed up your photos just in case something goes wrong!
  2. The script will only work properly if in my other script, om2exif.sh, you replace the exiftool option -overwrite_original  with -overwrite_original_in_place. If you don't, the new OpenMeta tags mysteriously disappear if you view them with Tagit.
  3. Unfortunately, because my om2exif.sh script does not handle spaces in tag names, this script will not either. Perhaps someone can help me sort that with a line or two of code. To enable this script to handle spaces as far as transferring the tags to OpenMeta, simply uncomment the two lines marked with "use to handle spaces"  (delete the first "#" in the line) and comment out each previous line. This apparently is not recommended by the OpenMeta help file but I think the help file is probably either inaccurate or out of date! Otherwise, in the mean time, tag names are just as search able if you enter them as AlbertEinstein or ChrisR. 
  4. Close Picasa before running script otherwise it might not recognise all of the changes you have made to the tags.

Happy Tagging!

8 comments:

  1. geeeeeeeeeeeeeeeeeeeek! :)x

    ReplyDelete
  2. Not working for me. I am using Mac and Picasa 3.9.12.14.

    picasa2tags.sh -r /Users/ruyfialho/Images/02_cerimonia

    /usr/bin/picasa2tags.sh: line 86: syntax error near unexpected token `done'
    /usr/bin/picasa2tags.sh: line 86: `done'

    ReplyDelete
  3. A fantastic solution. I have not use the script yet since i have all my face tagged with space. ANy news on solving that problem, then im all in. People would pay for this. Keeping my fingers crossed you can help.

    ReplyDelete
  4. Brilliant Idea, but the script is not working : before the last line "done" as already noticed, you have to add "fi" to close the if statement.
    If the regionname is not implemented, you can put in line 62 :
    exiftool -IPTC:Keywords
    to catch the keywords.
    Then, it finally works, thanks to you Christopher !!!

    ReplyDelete
  5. Hi, sorry I never saw the replies to this. I thought I would have received an email but apparently not. Thanks to the last user for pointing out the missing 'fi'. I just looked in my own code and can confirm it was missing. Obviously a typo caused by reformatting the text to look nicer. Also thanks for the 'keywords' tip. When I next use the tool I'll add it and perhaps save it on GitHub if still useful. C

    ReplyDelete
    Replies
    1. ps - I have added the missing 'fi' to the blog post now.

      Delete
  6. For some reason I'm getting the same error when I run both scripts:
    picasa2tags.sh: line 23: syntax error near unexpected token `elif'
    picasa2tags.sh: line 23: `elif [ $1 = "-n" ]; then'
    Any idea what is going wrong?

    ReplyDelete
    Replies
    1. Very sorry I posted code with typos. I have replaced it with the a GitHub snippet with a fresh copy/paste of the code that I use. I just had a quick and it still works for me.

      Delete