Wednesday, May 16, 2007

What kind of photographer are you?

I was reading this interesting post on the inside lightroom blog. It shows how to use lightroom to show which lenses you use most. At the end, the writer poses the interesting question of how to make a histogram of which actual focal lengths you use. I don't think this is possible inside Lightroom, so I set out to write a very simple perl script to do it using the spotlight services in Mac OS X. Here it is:

cat flengthhistoscript.pl
#!/usr/bin/perl

$start=shift;
$end=shift;
$delta=shift;
$flength=$start;
$onlyin=shift;

print "Generating histogram of focal lengths starting at $start, ending at $end, and with stepsize $delta in the directory $onlyin\n";

while ($flength<$end)
{
print "$flength\t";
$endbin=$flength+$delta;
$commandstring="mdfind -onlyin $onlyin \"kMDItemFocalLength>=$flength && kMDItemFocalLength < $endbin) \" | wc -l";
system($commandstring);
$flength+=$delta;

}

Just copy and paste this (starting at the # mark and ending at the closing curly bracket) and save it in your Home folder as "flengthhistoscript.pl". You can call it in the following way:
perl flengthhistocript.pl 0 300 2.5 ~ > histo.dat

from your commandline (terminal.app), which will bin all files that have a defined focal length in your home folder (the tilde can be replaced by any folder you'd like) starting at a focal length of zero mm and ending at 300, with a 2.5 mm bin width. It saves the output in a text file called histo.dat. Here is an example of my Pictures folder plotted in Igor Pro, my favorite plotting program:


You can see that I tend to photograph on the short end. The big peak is in the bin 17.5 - 20mm, which is the short end of my standard kit lens (18mm), which tells me I should probably get myself a wider lens as I am constantly using it as short as possible. The peaks below it are my fisheye 10.5 mm and probably some images shot using Mariska's Point and shoot. One could adapt the above script quite easily to only give results for certain cameras, dates, locations, etc. as spotlight indexes all that info. Now go figure out your lens pattern!

1 comment:

Note: Only a member of this blog may post a comment.