Overlaying exif tags onto viewed image

Being blessed with a pretty rub­bish mem­ory I’ve become a big fan of Spaced Rep­e­ti­tion Sys­tems over the years. I’ve tried sev­eral but have set­tled down with the reas­sur­ingly sim­ple mnemosyne pro­gram. mnemosyne has been out for a long time and the cur­rently sta­ble release is 1.2 although there is now a beta ver­sion 2.x.

I use images a lot in my mnemosyne deck espe­cially for learn­ing plants and trees. One of the prob­lems I have is that mnemosyne doesn’t allow full screen view­ing of the images or zoom­ing in and out, although I think that is addressed in the new beta. Fur­ther­more, the 1.x release doesn’t really sup­port the idea of cram­ming, or ad-hoc test­ing, so if I, for exam­ple, want to have a browse through all my tree win­ter ident pho­tos it’s not par­tic­u­larly straightforward.

Most of my pho­tos are pretty well tagged and are cur­rently enjoy­ing a some­what hap­haz­ard jour­ney from f-spot to shotwell, but on the whole they are tagged, with the meta data phys­i­cally writ­ten to the files them­selves. For some time I’ve been mus­ing over a quick and easy way of brows­ing my images based on sim­ple search cri­te­ria but with lim­ited suc­cess. Often I rename images which has the ben­e­fit of mak­ing them rapidly find­able using the linux locate com­mand but this is not with­out its problems.

Ide­ally what I was after was a way of brows­ing images full-screen with the abil­ity to zoom in and out, skip­ping for­ward ran­domly or sequen­tially, and, impor­tantly, when I wanted to, eas­ily view­ing the exif tags writ­ten to the image.

I’m pretty much there, thanks to a shy lit­tle pro­gram called qiv. I don’t know where qiv has been all my life but it’s pretty much every­thing I like about a util­ity. Lean, mean and does what it does well. Using a bit of script­ing and link­ing I get the images I’m inter­ested together and chuck them some­where, such as /jlinks/imagebatch1. Then I invoke qiv with some­thing like:

qiv --autorotate --maxpect --fullscreen --delay=10 --random --no_statusbar --file /tmp/flist

where /tmp/flist con­tains the list of files I want to browse through.

This works pretty well. But there are problems.

If I want to see some infor­ma­tion about the image I’m view­ing, such as its file­name, I can press ‘i’. This dis­plays the sta­tus bar and if you hap­pen to be using mean­ing­ful file­names as I usu­ally do this can be suf­fi­cient to find out the name of the plant, bird, what­ever, you’re look­ing at. The prob­lem is that the text in the sta­tus line is too small for me. I can read it but it’s a bit of an effort. I searched for a solu­tion to this, assum­ing that it would be pos­si­ble to change the text size. If it is I guess it needs a bit of pro­gram­ming as it’s not read­ily obvi­ous if it’s pos­si­ble to recon­fig­ure it in any other way.

What I wanted really was a way to super­im­pose the file­name onto the image itself, in nice big let­ters. As is often the way I spent a lot of hours look­ing for a solu­tion that was star­ing me in the face.

qiv allows you to call an exter­nal com­mand based on cer­tain key­presses. It took me a while to realise that, far from being quite com­pli­cated, it was sim­ply a mat­ter of tak­ing the sam­ple qiv-command script that is shipped with qiv, chuck­ing it into my search path, and then hack­ing it to bits.

I’m still exper­i­ment­ing and for the moments I have a few options in my qiv-command file that dis­play the infor­ma­tion I’m inter­ested in. Most of the time I am inter­ested in the exif key­word tags embed­ded in the image as they reli­ably tell me what it is I’m look­ing at. They are retrieved in no par­tic­u­lar order but that doesn’t mat­ter — it does the job. I also found another util­ity called gnome-osd-client was pretty handy for over­lay­ing the text I wanted.

Here, for exam­ple, is the sec­tion of my qiv-command file for what hap­pens if there is a key­press of 0.

0)
 title=$(exiftool -t -title "${filename}")
 where=$(exiftool -t -Country -State -City -Location "${filename}")
 rating=$(exiftool -T -Rating "${filename}")
 tags=$(exiftool -t -Subject "${filename}")
 gnome-osd-client "${title} ""${tags}"" (Rating=${rating}) ${where}"
 ;;

This uses exiftool to get the infor­ma­tion I’m inter­ested in, then gnome-osd-client to dis­play it. gnome-osd-client isn’t actu­ally nec­es­sary, and other options I have are

 2)
  exiftool -t -title -Subject -Country -State -City -Location -model -Rating "$filename"

and even the brief (pro­duc­ing verbose)

 3)
  exiftool "${filename}"
  ;;

One curios­ity I dis­cov­ered dur­ing all this is that the –T switch on exiftool seems to cause con­ster­na­tion with gnome-osd-client. Unfor­tu­nately I was using this a lot ear­lier on and assumed that it was some­thing I was doing wrong, whereas it just seems to be a quirky clash between the two util­i­ties. If you use –T any­where with exiftool in the gnome-osd-client com­mand you will get an error. e.g.

 4)
  gnome-osd-client "$(exiftool -T -title -Subject -Country -State -City -Location -model -Rating "${filename}")"
  ;;

will fail.

Of course, this doesn’t give you any of the spaced rep­e­ti­tion logic that you’d get from using a sys­tem such as mnemosyne, and per­haps with mnemosyne 2.x this sort of facil­ity might be bui­ilt in any­way. How­ever it’s quite nice to just spec­ify a search key­word and get a slab of brows­able images on the screen.