Tue, 22 Apr 2008

Photography Hack: Plot Your Focal Length Trends on your Mac

I've been thinking about buying a Canon lens to replace the somewhat inadequate kit lens that came with my Canon XTI.

So I posted on an expert forum asking about two lenses, and got some interesting advice, most of which was along the lines I had predicted.

But one poster pointed out that I might have a gap in my focal lengths by having a 10-22mm lens (a lens I might buy down the line) and a 24-xmm lens (where x: {70,105}mm). The suggestion was to use a piece of software called "ExposurePlot" to determine if the kinds of pictures I shot fell into the 22-24mm range. Now, that's a narrow range, but still a valid point.

The poster suggested I use a program called "ExposurePlot", which, it turns out is a Windows program that analyzes EXIF data from your pictures to determine focal length of your exposures, and then generates a scatter plot. Blech.

But never fear, OS X and Unix is here, and a perfect opportunity to blog about it (note, the following steps assume you are relatively comfortable with the Unix terminal):

  1. Download the free command line jhead EXIF utility.
  2. Launch Terminal.app
  3. Type cd [directoryname] to get to your photos. Mine were in Pictures/iPhoto Library/Originals (Protip: Use [tab] completion to type directories in Terminal-- or you'll need to "escape" spaces by preceding them with a \ character...)
  4. Type find [dirname] -name "*.JPG" -exec ~/Desktop/jhead {\} \; | grep Focal | sort | uniq -c | sort -n" where [dirname] for me was 2007 2008... that is the directories 2007 and 2008, the duration I've owned my SLR, and consequently the iPhoto directories that contain my SLR photos. Also, I unpacked jhead into my Desktop, hence the ~/Desktop/jhead... By using -name "*.JPG" I avoided double-counting my RAW images.
  5. If you want to generate a nice scatter plot, use a similar command to generate a focal length text file like so: find 2007 2008 -name "*.JPG" -exec ~/Desktop/jhead \{\} \; | grep Focal | sort | uniq -c | sort -k4 | sed 's/mm//' | awk '{print $5","$1}' > ~/mm.txt This will create a file called "mm.txt" which contains a comma delimited list of focal lengths and count of exposures.
  6. Open this file with Excel, tell Excel it's a comma delimited file, and chart the two columns into a scatter plot.
What I found was that most of my pictures are taken at 300mm, followed by 70mm, 50mm, 55mm and 18mm. In other words, at the limits of my primary lenses. Less than 2% of my shots fall inside of the 22-24mm focal length.


Name/Blog: rus
URL: http://rus.berrett.org/blog/
Title: interesting topic...
Comment/Excerpt: I ran your find command (using -iname instead of -name) and produced a beautiful graph of focal lengths versus exposure counts for pictures taken with my Canon EOS 30D. I have the stock 18-55mm lens, so my range is much more narrow than yours. Check it out here: http://rus.berrett.org/pics/2008/focal_length_graph.jpg

Name/Blog: Khan
URL:
Title: Curious...
Comment/Excerpt: Very interesting to see that your chart mirrors mine... that there is a surplus of exposures fully zoomed in. What this tells me is, if we had lenses that had greater telephoto, we probably would have used them...



Khan Klatt

Khan Klatt's photo