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

./focalAnalyzer.sh
Analyse Digikam’s DB and provide statistics on the focals used.
Report bugs to <photo@tassy.net>
Usage: focalAnalyzer.sh [-pdf|-png]
Just run the script passing as a parameter whether you prefer a single PDF file or a set of PNG files
$ ./focalAnalyzer.sh -pdf
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 !

CC-GNU GPL
This software is licensed under the CC-GNU GPL version 2.0 or later.

  9 Responses to “Focal Length Analysis”

  1. 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 :) )

  2. [...] Minor fixes based on the comments of silviu [...]

  3. [...] out the program’s page to download the [...]

  4. 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

  5. [...] out the program’s page to download the [...]

  6. [...] Focal Length Analyzer is a nifty little Bash script that pulls focal length data from digiKam’s database back end [...]

 Leave a Reply

(required)

(required)


− 2 = 2

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>