Hack Your Exif Data from the Command Line: Five Fun Uses for Exiftool

It happens every time you press the shutter. Tiny circuits spring into action and furiously record the information from every sensor pixel onto your memory card. But pixel information is not all that is recorded. With every shutter press, your camera records dozens of interesting details about how the photo was taken. These details are tucked away deep inside the labyrinth of code that comprises your photo file. Photo editing softwares, such as Photoshop or Lightroom, can unlock some of this data for viewing later. But they normally only scratch the surface of the available information by displaying only the most commonly used Exif tags.

To mine the deepest depths of your Exif data, you may want to try a utility called Exiftool. This utility is known for its ability to squeeze every last drop of information from your Exif data. Don’t expect a slick, graphical interface, though. Although there are more user friendly softwares which incorporate the Exiftool engine, we’re going to demonstrate Exiftool where it is at its minimalist best – at the command line.

Exiftool was written by Phil Harvey, an amateur photographer who spends his day hours as a nuclear physicist at the Sudbury Neutrino Observatory at Queen’s University. When he saw that his software, originally written to catalog scientific images, was useful for all types of photographs, he elected to freely distribute the open source code to the public. A physicist-photographer-programmer who gives his work away free – this guy has some serious geek cred!

So shut down that fancy graphical interface, pop open a command line, and pretend you’re hacking into the Matrix. Neo is waiting.

Installation

Windows and Mac OS X installation packages and installation instructions are available here. Working with Exiftool does require some basic knowledge of the command line – either the Windows DOS command prompt or the traditional UNIX command line in Mac OS X. We won’t rehash the basics here but there are plenty of tutorials throughout the web which address this. If you decide this is too deep for you, don’t worry. Just remember the tool is there if you ever want to come back to it.

Exiftool Projects to Try

Once Exiftool is installed, here are five exercises which should give you some idea of what you can accomplish with this tool.

1. Navigate to your photos directory and run the Exiftool command line utility on one of your raw photo files. Just enter the command below and then marvel at the stream of data that is extracted. Raw files will be much more interesting to examine since much of their information can be stripped during jpeg conversion.

exiftool -a -u -g1 filename

2. Since the first exercise likely generated many pages of information, try exporting the data to a text file for a more careful examination.

exiftool -a -u -g1 filename > exifoutput.txt

3. Examining a single photo file is a good way to learn what snippets of information are stored in your raw photo files. Once you find a particular parameter of interest, you can then exploit it using Exiftool’s multi-file processing option. The command below parses an entire directory of images (including subdirectories), extracts the focal length of each image, and writes it to a tabulated text file.

exiftool -T -r -lens -focallength directory > exifoutput.txt

Once all this information is compiled, you are just a spreadsheet away from a complete data analysis of your photography habits. The graph below shows the focal length used for each of the 4,000 images taken with a 28-135mm lens.

4. A similar query can also be constructed to show your shutter speed habits.

exiftool -T -r -lens -shutterspeed directory > exifoutput.txt

The graph below shows the shutter speed used for each of the 40,000 photos taken with a Canon 7D.

5. If you looked hard enough in exercise 2, you may have noticed a particular parameter that caught your interest. For the Canon 7D, an intriguing snippet of information recorded with each photo is the camera temperature. Should your camera also capture this, simply run the following query:

exiftool -T -r -lens -cameratemperature directory > exifoutput.txt

Then you can prove to your friends just how cold it was that day you photographed the snow storm of the century.

These are only a few of the many ways Exiftool can be used to mine your photo data. How much practical value is there in such an intense analysis of your photos? Debatable. But in the true spirit of geek adventure, we don’t do things because they are practical – we do things because we can.


About the author: Preston Scott is an engineer, photographer and founder of Camera Technica. This post was originally published here.

Discussion