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.


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.

  • Jonathon Watkins

    Ooooh, now if this was developed into a Lightroom plugin…. :-)

  • perceptionalreality

    Nearly all of the information that this article shows that you can get from your images with exiftool and the command line interface can be pulled from Lightroom with very little effort. In the Library module just select “Metadata” and thenset the category for each of the columns to the fields you’d like to analyze, such as lens used, focal length, ISO, etc. Then in the left panel select the specific folders you want to analyze, or just “All Photographs”. Now browse in the columns at the top to see the image count for each value in each category. With this method I was able to analyze a couple months’ worth of editing I’ve done for another photographer, Dave. (I don’t even have the actual files anymore; Lightroom just remembers all of the metadata.) My sample set is 3,119 images. From that ample set I found: • 89.5% of the images were taken with his Sigma 10-20mm lens. (My rough guesstimate was 90%, so I’m rather proud of myself for basically nailing that one.) • 46.5% of those images were taken in the 14-16mm range, which confirms my hypothesis that I will be very happy with the Pentax 15mm f/4 Limited lens for architectural photography. (It renders a more dramatic, “3-dimensional” feel than zoom lenses do, and it is tremendously flare-resistant even shooting right into the sun, so this should give me an edge over those who shoot exclusively with zooms. This is also a hint to Dave that he should maybe consider the Nikon 14mm. Mind you it’s about 3 or 4x the price of the Pentax…) Also, only 12.4% of the images were taken wider than 14mm. And many of those were cropped in tighter after correcting for converging vertical lines from the camera’s perspective. (And, for the record, I had hypothesized that half of the images would fall in that 14-17mm range. Not bad, ‘eh?) • The fact that there were so many taken in the range of that lens I covet made me wonder where other groupings may lie. So now including his 24-70 lens in the numbers I found that the single most frequently used focal length is 20mm (his ultrawide lens zoomed all the way in) with 17.4% of the entire set of images, or 19.4% from that lens. If we expand the criteria to include 18-24mm (the last 3 values from the ultrawide and the widest from his midrange zoom) that accounts for another 40.4% of the entire set of images. This is a very close match to the Pentax 21mm f/3.2 Limited lens I also covet. :) • The remaining 13% of the images are clumped closely around 31mm and 40mm, which just happen to be the focal lengths of two of the most popular Pentax prime lenses. Seems they knew what they were doing when they selected those exact focal lengths (though Pentax says they were selected for absolutely optimal image quality and compact design). This entire set of prime lenses and a camera body would fit EASILY into my waistpack (Think Tank Photo’s Speed Freak bag), and if I skip the 31mm (the largest and most expensive of the four I mentioned) the total cost is less than the price of the “Professional Standard” Nikon or Canon 24-70mm f/2.8 lens. They don’t zoom and they aren’t quite as bright, but they are wonderfully sharp, contrasty, compact and affordable. • Just over half of the images in the entire set were taken at ISO 320. Including the 1/3 stop values immediately above and below that (250 and 400) brings us to 70%. Particularly on Dave’s camera this is a very high quality range in which to work. • How about shutter speed? 82.8% of all images were taken in the easily hand-holdable and flash-syncing speed range of 1/100-1/200 second. Substantially more were taken at faster shutter speeds (hand-holdable but not flash-syncable) than at lower speeds (flash-syncable but tripod recommended). Tells me that a tripod is likely not needed in most situations. • Dave is nothing if not consistent. :) 85.5% of all shots were taken within 1/3 stop of f/8. Personally I would have gone for f/11 and ISO 640…Isn’t this fun?!?! And you don’t even have to touch the command-line interface to see all of this. (But you should if you want to actually graph it out as Preston did in the article. If you just want to glance at the trends you don’t need to go that far.)You know what else would be really interesting? To now analyze Dave’s entire set of photos, rather than just the ones he selected, to see how these results compare. Then look at just the “rejects” to see if they are consistently inconsistent with the above results. Yeah, I’m a seriously nerdy photographer. :) Oh, and in case anyone is wondering (and somehow still reading??), the reason I used Dave’s images instead of my own is because most of my existing work I could analyze are weddings and portraits (mixed on-location and in-studio which should be analyzed separately as well as together) and they are spread across numerous hard drives and archive discs. Dave’s were of a more consistent subject matter and all in the same place on my computer. 

  • perceptionalreality

    Wow. All of my formatting was lost. :( 

    I swear I had that set up in easy-to-read paragraphs! 

  • GatesMaura44

    my buddy’s sister-in-law made $18108 a month ago. she worrks on the internet and bought a $525400 condo. All she did was get blessed and put into action the instructions given on this website ===>> ⇛⇛⇛⇛►

  • Ivan

    I am using PhotoME to extract detailed EXIF information:

    Especially interesting is to check real shutter count when buying a used camera. (Pentax DSLRs have parameter Shutter Count in Manufacturer Notes section, I don’t know about other brands.)

  • Ninpou_kobanashi

    I find it easier to crunch data with exiftool.  Actually, Aperture has better  metadata search capabilities.  I use all 3 pieces of software.

  • perceptionalreality

    Right. If you need to “crunch data” use exiftool, as I said. But if you just want to glance at trends you don’t need to bother if you have Lightroom. I assumed Aperture also offers a similar view, but I didn’t have a fast enough graphics card that could run Aperture when it came out, but Lightroom worked just great and I’ve used it ever since.

    Also with exiftool you need to be sure you’re only examining one copy of each image. It’s easy to accidentally also look at exported jpgs and so forth, while Lightroom won’t have those exported files in the library unless you’ve specifically told it to import them.