Saturday, 29 December 2007

Photographic Metadata

When I first started with an SLR camera, some 13 years ago, all camera magazines had the same advice for beginners: to improve your pictures, write down all the settings you used, such as aperture or shutter speed, so that you can go back to this information once you have the prints and understand why they came out the way they did. As a result, a serious photographer would always have a small notebook with him to write all this down. It was quite a time consuming process but essential for who wanted to improve. In this age of digital photography, it would seem sensible for the camera to store this information with the picture so that you can retrieve it later. And indeed they do, in metadata called EXIF data that is embedded in the image file. Software like Photoshop is able to read EXIF data but it's a bit overkill to fire Photoshop just to look at this data. And it would also be nice to be able to write scripts based on it, such as a script that selects all pictures taken at a particular focal length.

Such a tool exists: it's called, quite simply, ExifTool. The tool is written in Perl so should work on any system that has Perl installed. There is a package for Mac OS-X that makes it really trivial to install. A proper install on Linux is slightly more convoluted so here's how to do it on Ubuntu:

  1. Download the latest version from the web site, in my case version 7.08;
  2. Extract the content of the file:
    $ tar -xzf ./Image-ExifTool-7.08.tar.gz
    
  3. Install the Perl libraries so that they can be used by other Perl scripts:
    $ cd ./Image-ExifTool-7.08
    $ perl Makefile.PL
    $ make
    $ make test
    $ sudo make install
    
  4. Install the main script:
    $ sudo cp exiftool /usr/local/bin
    

Alternatively, you can use ExifTool directly from the directory where you extracted it if you just want to try it out. Using ExifTool in the command line is very easy, just call:

$ exiftool myfile.jpg

And it will output all the metadata tags it knows about. There are a number of options available, in particular, you can select what tags you want to see. It's all very well explained in the man page. And if you run exiftool without arguments, it will actually display said man page. So what sort of fun stuff can we do now? Here is an example that selects all the files with a .JPG extension in the current directory and below that are photographs taken with a focal length of 105mm:

$ for f in `find . -name "*.JPG"`; do
> if [ -n "`exiftool -FocalLength $f | grep '105.0mm'`" ]; then
> echo $f
> fi
> done

Note that ExifTool formats its output such that it prints out the name of the tag followed by a colon and the value. If you want to strip that name and only keep the value, you can do something like this:

$ exiftool -FocalLength myfile.jpg | sed 's/^[^:]*: //'

An interesting application, if you have a GPS receiver is to combine the GPS trace log with the EXIF time information to geo-tag your photographs. There are a number of links on the ExifTool web site that point to such utilities. Once geo-tagged, online photo sites like flickr will use this information to position the pictures on a map. Or more simply, to come back to what I was talking about at the beginning of this article, you could compare basic shot settings between pictures to understand why one is better than another.

Note that there are other tools than ExifTool to do this, some of them offer a graphic front-end that may be easier to use for those who are not comfortable with the command line, but ExifTool is by far the most complete and powerful. Just google for exif reader if you want to find other options.

Friday, 21 December 2007

Zend Framework on XAMPP

I am currently experimenting with the Zend Framework, using XAMPP on a Windows laptop and following Rob Allen's excellent tutorial. With a default installation of XAMPP, you get a nasty Error 500 whenever you test your system. This is because XAMPP doesn't enable the Apache mod_rewrite extension by default. So here's how to do it. Find the Apache configuration file, called httpd.conf, which on my install is in C:\xampp\apache\conf and uncomment the following line:

LoadModule rewrite_module modules/mod_rewrite.so

Restart XAMPP and it should all work.

Saturday, 15 December 2007

Road Rage

Why is it that being at the wheel of a car transforms most reasonable people in arrogant aggressive maniacs? I was just walking down the road when I saw this guy change lane, cutting off the driver behind in the process. Of course, the guy behind sounded his horn briefly to tell him he wasn't too happy about that manoeuvre. And what did the guy in front do as a result? Show him the finger. Well done for being an arse!

Friday, 30 November 2007

Desktop Tower Defence

If you're in need of an addictive time waster, try Desktop Tower Defence. Don't be surprised if you end up spending a few hours and missing dinner blasting creepy things.

Via The Register

Free Rice

It all started with The Hunger Site and it seems there are more and more of those sites where you just have to click to help end world hunger or do some other good deed. FreeRice is another one of those but it adds an interesting twist: your clicks are based on a vocabulary game and they only count if you get the meaning of the words right. For every 3 correct answers, your vocab level goes up one and for every mistake it goes down one. The higher the level, the more difficult are the words you are given. The game is dead simple but very, very addictive and is also a great way to improve your vocabulary. So give it a go and see what level you can reach: the maximum is 50 and they reckon very few people go past 48.

Hidden Cost of Viruses

Computer viruses can cost you time and money, that's obvious: if your computer gets infected by a nasty virus, it can take ages to clean it, sometimes even requiring you to completely re-install your operating system from scratch. But there are other hidden costs to viruses and they can even cost you when your computer doesn't get infected. I have been discovering one of those costs on my new contract. I got given a nice laptop running Windows XP Pro (Vista? Who said Vista?) complete with corporate security software. And that's where the problem is: the virus scanner is configured to do a full scan every time I switch on the computer. So the routine in the morning is simple: arrive in the office, plug in the laptop, switch it on and go get a coffee. Then wait some more until it's finished thrashing the hard disk. End result: 15 minutes every morning.

Thursday, 22 November 2007

Gmail Spam Filter

Gmail used to have the best spam filter ever: I would never get spam in my inbox. In fact, until a few weeks ago I would have been unable to say when was the last time I had pressed the Report Spam button. Unfortunately, over the past few weeks, I've been clicking on that button more and more, the last time being 5 minutes ago. I only get a few a day at the moment but the worrying thing is that they are all email that look like they should be blocked by the most brain dead of spam filters. Is something broken in the Googleplex? In their relentless attempts at blocking the more devious spam messages, did they accidentally break something in the code that was blocking the simple ones?

Saturday, 17 November 2007

Online Christmas Shopping

I went out to central London to do some Christmas shopping today, as for once I decided to start early. It was such a bad experience because of the masses of people that I bought nothing and decided to do everything online from now on.

Friday, 16 November 2007

Estate Agents' Reading Skills

After wondering at the Labour Party's members' reading skills, I now worry about the same skills with estate agents. I just had one of them trying to open my door in order to show a flat to a customer, when in fact he wanted the flat next door. Of course his keys didn't work. Now, my door has a big letter A on it, while the next door has a big letter B. This is meant as a clue that my flat is flat A, while flat B is next door. But apparently, that was way too complicated for him.

St Pancras International

I've been going through St Pancras station every week for 2 months or so. But when I came back to London yesterday, it no longer was St Pancras, it was St Pancras International, now that the Eurostar trains leave from there rather than Waterloo. I have to say the new station is large and impressive, of course full of shops in case you want to do a bit of shopping before getting on the train. It is amusing how they insist on the International bit though. Should Paris Gare du Nord be renamed Gare Internationale de Parid Nord?