Focal Length Analysis
Ever wondered what lens to buy next ? of course you have !
Since I started using Digikam for Digital Asset Management, storing all this important meta-data in its database, I have seen more and more situations where searching in Digikam made my life much easier than searching desperately for files on a disk.
Recently, I thought about the fact that this database holds precious info regarding the way I shoot ! What focal length I tend to use, what apertures, what ISO speed, do I use flash often, etc …
I figured that if I could show on a graph what focal length I use most, I might decide to buy a better piece of glass for that focal or on the contrary, decide to complement my lens park in other areas.
so I just put together a little bash script that will analyse you Digikam DB and produce a PDF file in which, each page holds a histogram showing the focal length repartition for a particular camera model.
To run the script, your system needs to have the following packages: sqlite, gnuplot, ImageMagick
Analyse Digikam’s DB and provide statistics on the focals used.
Report bugs to <photo@tassy.net>Usage: focalAnalyzer.sh [-pdf|-png]
Analyse Digikam’s DB and provide statistics on the focals used.
Report bugs to <photo@tassy.net>Backend is SQLite
Processing Canon EOS 400D DIGITAL
Processing Canon EOS 40D
Processing Canon EOS 60D
Processing Canon PowerShot A630
Processing FinePix S5800 S800
Processing N97
Processing NIKON D50
Generating PDF …
You will end up with a focalAnalysis.pdf file in the current directory containing graphs like this:
The latest version of the script can be downloaded from the attachments section at the left of this page !
If you like this script, feel free to leave a comment !
Hi,
Thank you for this great script. I wanted to let you know that running on slackware required the following modifications to mktemp – obviously the verssion packaged with slacware (64 current) is different to yours:
–tmpdir is not recognized – I had to use -t instead
– the template for mktemp must have 6 numbers: so I added three more X’s to both lines
– the template must end with the numbers so I had to move XXXXXX.csv to .csv.XXXXXX
Thanks again. I want a fast prime and I was struggling to decide between a 28mm and a 50mm. Your graphs helped a lot (over 10000 shot at 28mm versus a few hundreds at 50mm gives a good ideea on usage 🙂 )
Hi Silviu, thanks for the feedback ! glad the script could help
I’ll add your changes to the script shortly.
Hi Silviu,
finally got around to implementing your recommendations except for the “-t” as it seems to be a deprecated option
[…] Minor fixes based on the comments of silviu […]
[…] out the program’s page to download the […]
Great script, many thanks for this!
Just one little bug: I have got Pentax K20D which is not stored as ‘PENTAX K20D’ but as ‘PENTAX K20D ‘. Don’t know the reason why this happened in digikam database, but quick and dirty patch in sql command did the trick…
line 125:
if [ $DBTYPE == "QMYSQL" ]; then # Didn't manage to create csv files properly with MySQL ...
$SQLCOMMAND "select focalLength, count(focalLength) from ImageMetadata where model='$model' and focalLength IS NOT NULL and focalLength > 0 group by focalLength" | sed -e 's/\t/,/' >>$CSV
else
if [ "$model" == "PENTAX K20D" ]; then
model='PENTAX K20D '
fi
$SQLCOMMAND "select focalLength, count(focalLength) from imageMetadata where model='$model' and focalLength IS NOT NULL and focalLength > 0 group by focalLength" >>$CSV
fi
Thanks czernitko,
I will add your patch to the script.
[…] out the program’s page to download the […]
[…] Focal Length Analyzer is a nifty little Bash script that pulls focal length data from digiKam’s database back end […]
My brother recommended I might like this blog. He was totally right.
This post actually made my day. You can not imagine simply how much
time I had spent for this information! Thanks!
Old post, but I had to say: Absolutely fantastic script, thanks so much!