Focal length analysis of my photo collection

New lens – what should I buy

I am a very happy owner of ultra-wide zoom Nikon f/3.5-5.6 G ED 18-200mm  lens. I bought it in 2007 (the original model) and have not parted with it since. The best lens I’ve ever used. I love it. t is portable enough for travel and it covers a wide spectrum of focal lengths, so that I do not need to take any other lens with me for hiking and cycling trips. Why do I need a new lens? Zoom lens, even a very good one, is always a bit inferior to a single focal length (prime) lens. For some time now I’ve been thinking of a prime, especially when trying out more advanced photography techniques.

One of the best performing, sharpest, and highly recommended prime lenses is the Nikon 50mm 1.8G lens. So, decision made. Simple! After deciding to purchase a new 50mm prime lens I thought I’d better check if the 50mm is what I really want (on DX DSLR the 50mm becomes 75mm lens). How to know if I need new 50mm lens? Well, if I shoot a lot of photos around the 50mm focal length, then it would be more than justified to invest into a prime, well performing lens with that focal length. I simply need to analyse what focal length I mostly use in my photographic endeavors.
Simple – I’ll take a collection of photos I have, check from the EXIF data what f-number each photo has, and plot the data in a form of histogram.

After hacking a simple NodeJS script with exif module for about an hour, it turn out that even for a simple folder the program runs out of memory. 10min later, I had a bash + awk script ready and gnuplot was showing me the data – I explain here how to generate a focal length histogram for your own photo collection.


First half of 2012

I’ve done 995 photos so far (first half of 2012). These are mostly outdoors shots on trips and indoors family photos. The first test was to run it on all those 995 photos. As you can see, most of the “action” happens in the focal length range of up to around 80mm. I’ve decided to have a closer look into the range of up to 100mm. The second graph depicts just that region from the upper graph (they are the same, it is just easier to see certain patterns).

The x-axis depicts the focal length in mm, and the y-axis depicts the total number of photos taken with a given focal length.


Himalayan expedition

For the second try, I’ve used photos from the cycling expedition to Himalayas, that I’ve done with my brother at the end of last year. The collection consists of 1140 photos. Almost all are outdoors sceneries, monasteries, and mountains. Early winter shots, almost always with clear blue skies. Same as before, I’ve highlighted the area of focal length of up to 100mm in the lower diagram. Comparing these two it is easy to see that although in both cases the lowest focal length of 18mm dominates, the expedition did generated more “interest” in the wider focal length area – the histogram seems more dense.

Entire collection

For the final test I’ve used all the photos that I have on my laptop. The collection is just over 20,000 photos. Most of the photos are mine from my own camera. Some are from other people, most notably from my brother. And there are some from non DSLR cameras (notice the wide-angle shots in the range below 15mm). The new 50mm spike is due to about 1500 photos that my brother took during our Himalayan expedition – he opted for a lightweight, single prime lens setup.


The exercise turned out actually quite revealing. I was not aware that the lowest and highest range of my lens (18-200mm) are so heavily used throughout my photos, with the lowest, 18mm being the hands down winner. Overall, due to the nature of outdoor photography, the lowest (wider) spectrum is more frequently used that the upper half of the focal length spectrum. It is also clear that majority of the photographs are in the range below 50mm. Note also, that the 50mm reported by my brother’s lens is in fact 75mm focal length on the DX camera.

Final decision

After the exercise it was rather clear that I actually would not “like” the new 50mm (75mm) lens. In fact, something between 20-40mm would probably be the most appropriate. Voila – there is a relatively cheap, highly praised Nikon 35mm f/1.8 AF-S DX lens which I’m going to get instead.