Saturday 6 October 2012

Google vs. Nokia

Well, not exactly.

I'm writing a program that embeds a Google map in a Qt graphical user interface (GUI). Google maps is provided by Google (duh!) and Qt is a GUI framework from Nokia. And the two are not playing nicely.

The problem is that you can't use the mouse to drag the map, or double click to zoom it. A bit of web searching revealed that this is a known issue (http://qt-project.org/forums/viewthread/1643/). The suggested solution is to set the "user agent" string to "Chrome/1.0". I did this and everything started working correctly.

A few days later, the map was back to the undraggable version, so I tried another solution - specifying that one wants version 3.1 of the Google maps API by adding "&v=3.1" to the URL used to load the map. Having done this, everything was working correctly again.

Until a few days later. Now it seems Google no longer serves version 3.1 and any request for it returns version 3.2.

The root cause of the problem is that Google interrogates the Qt web browser component and discovers it has a "multitouch" interface, as used on smart phones and tablet computers. Google then serves a version of Google maps suitable for such devices, but almost  unusable on a normal mouse driven desktop PC. There appears to be no way to disable this feature of Qt without recompiling it, a task that will be beyond most users of the software I'm writing. However, given that it's a compilation option, I do wonder why versions of Qt compiled for desktop PCs have it enabled by default. Do leave a comment if you know a solution.

Meanwhile, I'm off to investigate alternative map providers.

Thursday 4 October 2012

Photini - what's in a name?

In my last post here I wrote about my decision to start writing a digital photograph metadata (i.e. EXIF, IPTC, XMP) editor, having failed to find one I like that runs on Linux. The good news is that I've made good progress and it's now pretty much ready for public consumption, although it desperately needs a lot more documentation.

So now, I present to the world Photini. Probably the most difficult decision was what to call it. My original plan - "Jim's photo metadata editor", or JPME for short - didn't really feel right, and when I discovered that JPME stands for "Joint Professional Military Education" then it had to go.

We live in a world where product names say little about what the product does. Who would guess that Orange™ is a phone network? BT is no longer British Telecom, and BAA is no longer the British Airports Authority. Full names are much too specific. So why should my bit of software have a code letter sequence for a name?

I've noticed one or two other open source projects adopting girls' forenames, so I did a quick web search for lists of girls' names. I also thought it might be nice to have some connection to photography, so I zapped down the list to names beginning Ph. And there it was - Photini.

Photini is a Greek name meaning 'light'. She was a saint, according to the Christian orthodox church, and on one church calendar (according to orthodoxwiki.org) her feast day is my birthday! I'm an atheist, but I like a nice coincidence as much as anyone else.

PS Apologies to all those real people called Photini who now find a bit of lousy software has taken their name.

Sunday 23 September 2012

Editing photograph metadata

A much neglected task for any photographer is labelling one's photographs. In the old days one could write on the back of a print, but as I always preferred slide film this wasn't an option. So I created a database in which I stored a simple title and description of each slide. However, as it would often take me many months to finish a film it was sometimes unclear when and where any particular picture was taken. So I've finished up with too many slides labelled "somewhere in France".

In this age of electronic photography everything should be so much easier. There are standardised ways of storing information about the image in the image file itself. This so-called metadata is then permanently attached to the photograph. It doesn't fade or get lost when a database crashes. What's more, online services such as Flickr can use this metadata to label photographs when you upload them, saving you the trouble of writing it all again. And with photos being loaded into a computer within hours of taking them there's no excuse for forgetting any details.

On my Windows XP computer I have an easy to use metadata editing program called Microsoft Pro Photo Tools. Surprisingly Microsoft seem to have discontinued it, as there is no Windows 7 version.

The screenshot shows the key features. I load a group of images, typically one day's photos, whose thumbnails are displayed in the lower half of the GUI. After selecting one or more of the images I type metadata into the boxes in the upper half. Switching to the "map browse" tab I can drag and drop images to a map to set their location data. This really is a simple to use program that should have been more heavily promoted.

Since choosing Linux as the operating system for my main computer I've been looking for a suitable photo metadata editing program. None that I've tried has the required features. For example, some only allow you to label one picture at a time and others have a very cluttered interface that has too much technical detail. So I've decided to write my own.

As you can see, I've borrowed some of the look and feel from Photo Tools. I'm writing the software in Python, as that's what I know, and I'm using PyQt to create the GUI. Python has a very good library to read and write metadata called pyexiv2. My program is still at a very early stage of development but I'm very pleased with how it's coming along. I've even managed to load Google maps into the GUI.

My only difficulty has been in getting my head round the multiplicity of metadata standards - EXIF, IPTC and XMP. Some data, such as title or copyright info, can be stored in all three. I've decided to try and make my program follow Postel's law so it will read data from any standard and write to all three. This should maximise its compatibility with other programs.

Needless to say, when it becomes usable I'll be making it available as open source. Watch this space.

Edit 2012/09/26: early version is now available from github: http://github.com/jim-easterbrook/Photini