Tag Archives: mnemosyne

Overlaying exif tags onto viewed image

Being blessed with a pretty rubbish memory I’ve become a big fan of Spaced Repetition Systems over the years. I’ve tried several but have settled down with the reassuringly simple mnemosyne program. mnemosyne has been out for a long time and the currently stable release is 1.2 although there is now a beta version 2.x.

I use images a lot in my mnemosyne deck especially for learning plants and trees. One of the problems I have is that mnemosyne doesn’t allow full screen viewing of the images or zooming in and out, although I think that is addressed in the new beta. Furthermore, the 1.x release doesn’t really support the idea of cramming, or ad-hoc testing, so if I, for example, want to have a browse through all my tree winter ident photos it’s not particularly straightforward.

Most of my photos are pretty well tagged and are currently enjoying a somewhat haphazard journey from f-spot to shotwell, but on the whole they are tagged, with the meta data physically written to the files themselves. For some time I’ve been musing over a quick and easy way of browsing my images based on simple search criteria but with limited success. Often I rename images which has the benefit of making them rapidly findable using the linux locate command but this is not without its problems.

Ideally what I was after was a way of browsing images full-screen with the ability to zoom in and out, skipping forward randomly or sequentially, and, importantly, when I wanted to, easily viewing the exif tags written to the image.

I’m pretty much there, thanks to a shy little program called qiv. I don’t know where qiv has been all my life but it’s pretty much everything I like about a utility. Lean, mean and does what it does well. Using a bit of scripting and linking I get the images I’m interested together and chuck them somewhere, such as /jlinks/imagebatch1. Then I invoke qiv with something like:

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

where /tmp/flist contains the list of files I want to browse through.

This works pretty well. But there are problems.

If I want to see some information about the image I’m viewing, such as its filename, I can press ‘i’. This displays the status bar and if you happen to be using meaningful filenames as I usually do this can be sufficient to find out the name of the plant, bird, whatever, you’re looking at. The problem is that the text in the status line is too small for me. I can read it but it’s a bit of an effort. I searched for a solution to this, assuming that it would be possible to change the text size. If it is I guess it needs a bit of programming as it’s not readily obvious if it’s possible to reconfigure it in any other way.

What I wanted really was a way to superimpose the filename onto the image itself, in nice big letters. As is often the way I spent a lot of hours looking for a solution that was staring me in the face.

qiv allows you to call an external command based on certain keypresses. It took me a while to realise that, far from being quite complicated, it was simply a matter of taking the sample qiv-command script that is shipped with qiv, chucking it into my search path, and then hacking it to bits.

I’m still experimenting and for the moments I have a few options in my qiv-command file that display the information I’m interested in. Most of the time I am interested in the exif keyword tags embedded in the image as they reliably tell me what it is I’m looking at. They are retrieved in no particular order but that doesn’t matter – it does the job. I also found another utility called gnome-osd-client was pretty handy for overlaying the text I wanted.

Here, for example, is the section of my qiv-command file for what happens if there is a keypress 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 information I’m interested in, then gnome-osd-client to display it. gnome-osd-client isn’t actually necessary, and other options I have are

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

and even the brief (producing verbose)

 3)
  exiftool "${filename}"
  ;;

One curiosity I discovered during all this is that the -T switch on exiftool seems to cause consternation with gnome-osd-client. Unfortunately I was using this a lot earlier on and assumed that it was something I was doing wrong, whereas it just seems to be a quirky clash between the two utilities. If you use -T anywhere with exiftool in the gnome-osd-client command 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 repetition logic that you’d get from using a system such as mnemosyne, and perhaps with mnemosyne 2.x this sort of facility might be buiilt in anyway. However it’s quite nice to just specify a search keyword and get a slab of browsable images on the screen.

housekeeping script to remove dead images

I use mnemosyne daily to learn plant identification and make heavy use of images. All the images are stored in ~dougie/.mnemosyne/images and are referenced from the .mnemosyne config file in ~/.mnemosyne/default.mem.

Sometimes I delete cards that I don’t like, are poorly phrased, or have something wrong about them. This doesn’t delete the corresponding image.

I need to write a shell script to scan the default.mem file and extract all the filenames for the image jpegs, then check whether they exist. No, hang it, that’s the wrong way round. Although that would be useful too as sometimes I delete an image but not a card.

Ah, so it has to be a two-way script. Checking for orphans both ways. Are there images that are not in cards? And are there cards that reference images that aren’t there?

I should probably also wait until version 2.x of mnemosyne hits the streets in case there are any layout changes.