At the Hadrian Hotel

At the Hadrian Hotel

Monday, October 31, 2005

A Picture is Worth a Thousand Data Points

Well, maybe more like a few dozen.

By now, we've all looked at digital photographs. We see them on the web, on our home computers, on PDAs and cell phones, and even on iPods. However, what you see isn't the entire story. Most JPEG photos you see today have more information encoded in them, in the form of EXIF and IPTC headers. The information in these headers can be viewed by many photo viewing applications, such as iPhoto and Preview on the Mac and Google's picasa, Stuffware's Photo Studio and Microsoft's Picture and Fax Viewer on MS-Windows.

Much of this data is put there by the digital camera but there are tools that you can use to add or change the information in these headers, as well as view them in more detail than is generally possible with photo viewing applications. Doing a search for EXIF on or Google will yield pointers to a number of different tools and web sites. The two tools I've made the most use of are jhead and ExifTool. The former is written in C and the latter in Perl. They both run under Linux, Mac-OS and MS-Windows.

Both of these tools can be used to display and modify the meta-information present in JPEG photos, but each one can make some changes that the other cannot. For example, jhead is only able to modify the "Comment" field present in JPEG photos that is outside of the EXIF headers, while ExifTool is only able to modify comment fields within the headers. Take a look around the web pages for each tool to see its particular strengths.

One of my favorite uses for jhead is to set the file creation date to the time stamp present inside the file (put there by the camera when the picture was taken). Another use is to correct both the internal time stamp and the file creation date if I've forgotten to change the clock on the camera when changing between Standard Time and Daylight Savings Time. Oh, and don't forget about those pictures you've taken in another time zone, before you remembered to fix the camera's date and time. :-)

Lately, I've been using ExifTool for geocoding. If you click on the image of Notre-Dame you will be taken (in another window) to its Flickr page.

Beneath the picture, you will see two links: "Fly to this location" and "geotagged." The former will cause Google Earth to fly you to France. If you don't have Google Earth installed, you can click on the "geotagged" link to be shown the picture's location via geobloggers. Note that Firefox on the Mac does not display the map image on geobloggers. Firefox on other platforms works just fine, as does Safari on the Mac. It is a well known problem with Firefox, but only on the Mac.

If you look near the lower-right corner of the Flickr photo page, under "Additional Information" you will see a "More properties" link. This will display all of the EXIF information contained within the photo.

Unfortunately, the digital camera I used to take this picture doesn't have the ability to tag photos with GPS information. Fortunately, ExifTool does. Here is the command I used to tag the image with GPS and IPTC location information:

exiftool -GPSLatitude = "48 deg 51' 11.00" -GPSLatitudeRef = "north" -GPSLongitude = "2 deg 20' 58.50"
-GPSLongitudeRef = "east" -IPTC:Country-PrimaryLocationCode="FRA" -IPTC:Country-PrimaryLocationName="France" -IPTC:City="Paris" IMG_3968.JPG

Another feature present in many modern digital cameras, but again lacking in mine, is the ability to tag the picture with the orientation of the camera when the picture was taken. Once again, it's ExifTool to the rescue! Here's a command to "rotate" the picture 90 degrees counter-clockwise:

exiftool -n -Orientation=6 IMG_1234.JPG

Unlike many photo viewing and editing tools, this command doesn't change the image information in the JPEG file, but merely changes the EXIF Orientation tag.

More information on these tags and others can be found in the EXIF and IPTC references above as well as numerous other sites reachable by a web search or a multi-tag query. Explore! See what you can find!

Oh, one more thing.... If you're going to be publishing your photos on the web, you may want to add a copyright notice inside the file. With the obvious command line changes, this can be easily done with:

exiftool -Copyright="Copyright 2005 YOUR_NAME_HERE" *.JPG

Will this stuff change the world? Probably not. Is it fun to play with? Well, a whole bunch of people have spent (wasted?) many hours tagging photographs and/or writing software to display them in interesting and unusual ways. Personally, I find it quite enjoyable to tag my photos and then see what's out there to let me use all of that information.

Technorati Tags: , , , , , ,

1 comment:

Arne said...

I found this post quite interesting, I have been messing around with similar things lately or at least been thinking about getting into messing more around with them.