Sunday, 15 April 2012

How do you find your favourite photos?

So, you've been won over by digital technology and, on holidays, find yourself endlessly snapping away with your camera. It does not matter how many photos you take, because it is free and you can delete the bad ones later. But what about the ones that are not bad and not that good? Ten years later you find that you have accumulated between 10 and 100 thousand photos. The few slide-shows you put together to show your mother were created with software on another computer, which you gave away when you had a brief fling with an iPad. How do you find the best photos of you and your dog? Good luck! 

The problem with using software to organise your photos is that it either costs money, is not available for all operating systems and most importantly you are trapped. All that work you did organising your photos is locked away in a piece of software that you might one day not like or could be discontinued or not supported on your next computer. Your photos should live longer than your computer. We need a better way. 

Tagging - its all about tagging!
In case you hadn't noticed, Windows 7 and Vista have tagging facilities built in. What you may have not known is that there are many free programs to provide this feature to other operating systems, such as Mac OS. Tagging is here to stay and one day tagging will be as standard as tabbed browsing. This is what tagging is:

Many computer files, such as photos and movies, enable one to hide written text inside them without it being normally visible. This enables one to set keywords and even descriptions and ratings to help one find them again. For example, if you went on a trip to New York you could enter the keywords "New York" and USA. On photos that contained you or your dog you can enter your names. Rating your photos might seem a faff, but if you rate the best with 5 stars and the better ones with 4 it makes setting up a slide show a doddle.

On Windows and Mac, by simply typing tag:USA Rover in the file browser search box would almost instantly bring up all the photos on your computer (or specified folder) of your dog, Rover, in the United States. On Windows, to show only the best photos, also enter something like rating:5 stars  or rating:>=4 stars, start a slide show and enjoy.

Tagging on Linux, XP and Mac
I haven't set up the use of tagging on my Linux netbook yet, but solutions exist, such as using Tracker and digiKam. I also gather that it will not be long before solutions with come bundled with the popular Linux distributions. There is TaggedFrog for Windows XP users, but again I have not used it. 

I usually use a Mac that is running Leopard and, unfortunately, I am disappointed that Apple are behind in the tagging game - probably because they want to trap their users in iPhoto, which I no longer want to use. I am not going back there. Particularly, as I like to sync my Linux netbook before I take it on an adventure. I still use it as my gps navigator!

Currently my favourite tagging software for Mac is Tagit, where one can drag selected photos to its icon in the Dock to set their tags and rattings. When the tags are set, as above, 
  • Enter something like  tag:USA Rover, in the search field in Finder. 
  • To select the best photos the command is starrating:5 or starrating:>=4  
  • To start a slide show in Leopard, select all of the photos you want to view and hit the space bar!
Sharing Tagit tagged photos with Windows users
The limitations of Tagit are that it does not support comments, one cannot easily review all of the changes one has made and it uses another method of storing the meta data than Windows that seems get lost more easily. For example, by attaching a photo directly to an email to send to another mac user the tag data is lost. To preserve tags when emailing you should zip the photos up together with the folder that they are in. I presume, because will include the hidden .DS_Store file. 

If you are happy always sticking with a Mac for now, you might be ok with only using Tagit. However, if you'd like to be able to share your tags with Windows users, the good news is that is already possible if you are prepared to learn a bit of Bash. You'll need the following command line programs
  • openmeta - to read or modify Tagit tags
  • exiftoool   - to set the EXIF data of photos
Both are free and easy to install and straight forward to use if you are familiar with using Terminal. To save you the time, I'll share my Bash script that copies Tagit tags to the EXIF data of photos so that they are also visible on Windows. Feel free to use and modify it as you like. I am no expert and can't guarantee it will do as expected so I recommend you always back up your photos before you run it. 

Novis instructions for how to use the following script:
  • You can copy/past it into a text editor and save it, perhaps in Pictures as
  • Open Terminal and change directory to Pictures (or wherever you saved it) by entering the command: cd Pictures
  • Make the script executable by entering the command: chmod +x
I organise my photos first by year and then by location or event. To copy all openmeta data to EXIF format for the year 2012 and recursively for all contained folders type the following command:
  • ./ -r 2012

  1. to access the script from any location you can add it to your path, such as putting it in the folder /usr/bin/ or by specifying your own user path
  2. When I need it, or if any one requests, I shall write a similar script to copy the tags in the other direction.
  3. The title of this post was a genuin question. Please let me if you have any better (free) solutions!

om2exif - the script


# BUGS: does not handle spaces in file names with -r and -p options
# NOTE: does not delete existing tags or rating if not set by openmeta

     om2exif -- copies openmeta tags to exif data readable by windows

     om2exif [OPTION] [DIR/FILE]

     -r   recursively copy tags for files in directory
     -n   non recursively copy tags in direcory
     -p   path to single file to copy tags

if [ x$2 = "x" ]; then
echo "$usage"

if [ $1 = "-r" ] ; then 
fileList="$(find $2 -name *.[jJ][pP][gG])"
elif [ $1 = "-n" ]; then
elif [ $1 = "-p" ]; then
fileList=$2  #$(echo $2 | sed 's/ /\\ /g')
echo "$usage"

for file in $fileList; do
echo updating "$file"
omkeywords=$(echo $(openmeta -p "$file" | grep tags) \.) 
omrating=$(openmeta -p "$file" | grep rating | cut -d ' ' -f2 | cut -d '.' -f1) 
echo $omkeywords
echo rating: $omrating
# translate keywords
while [ $(echo $omkeywords | cut -d ' ' -f$i) != "." ]; do
newtag=$(echo $omkeywords | cut -d ' ' -f$i)
if [ $i = 2 ] ; then
subject=$subject" -subject="$newtag
lastkeywordxmp=$lastkeywordxmp" -lastkeywordxmp="$newtag
i=$(( $i + 1 ))
# translate rating
if [ $omrating = "none" ]; then
rating=" "
exiftool -overwrite_original -xpkeywords=$xpkeywords $(echo $lastkeywordxmp $subject $rating) "$file"
echo "done"
echo " "

Useful commands
When you view the photos as described above they can be ordered by date or name. Ordering by name does not work if you have more than one type of camera. Ordering by time does not always work as the creation and modification times can/will be changed when edititing or if you scanned the photos from film etc. exiftool is useful here in that it can recursively rename your digital photos to incorporate the time and date they were taken. The following are the options I use. A comprehensive list of examples, such as for correcting creation or modification date given in exiftool's manual and online.

exiftool -r -ext JPG -d %Y.%m.%d_%H%M.%S%%-c.%%e "-filename<CreateDate" Dir/ # rename pictures

exiftool -r -ext MOV -ext AVI -d %Y.%m.%d_%H%M.%S%%-c.%%e "-filename<CreateDate" Dir/ # rename movies

NB: these are two commands spread over four lines. Replace Dir with your own directory name


  1. I forgot to mention another thing about using OpenMeta on Mac is that your tags can be lost if you need to revert to a backup of your files. However, OpenMeta apparently creates its own backup in

    Library>Application Support>OpenMeta

    Make sure to back this folder up if you use OpenMeta. There is some discussion about this here:

    All the more reason to copy the tags to the EXIF data of your photos. Although, another word of warning: Mac has another way of telling when a file was modified or created than is set in the EXIF data. Thus, if you modify your EXIF tags and do not rename the files to include the date in the format YYYY.MM.DD...JPG then you could have no way of displaying the pictures in chronological order.

  2. Stop Press - again!

    1) I either didn't realise at the time or forgot to mention that the above script does not support tag names with spaces either. If anyone can suggest a simply way of supporting this, without adding tags one by one, which is very slow, it would be much appreciated.

    2) It has come to light that a better option to use with the exiftool is −overwrite_original_in_place instead of −overwrite_original. The problem with overwrite_original is that it makes a copy of the original and then deletes it, which can mess up the MetaData tags. It is essential to change this in the above script for the following script to work.

    3) Yes, a new script! I just published it - see the next post. This one copies Picasa name tags to OpenMeta and Windows format so that it can be indexed by the Mac and Windows search engines.