Use the Focal Length Analyzer Script with digiKam

The Focal Length Analyzer is a nifty little Bash script that pulls focal length data from digiKam’s database back end and generates nice graphs based on the extracted data.

To perform its magic, the script relies on the sqlite, gnuplot, and imagemagick packages. On Ubuntu and Debian-based distributions, you can install these packages running the apt-get install sqlite3, gnuplot imagemagick command as root. Download then the latest version of the script and make it executable using the chmod o+w command. The script accepts two switches: -png and -pdf. Use the -png switch to generate separate graphs for each camera model in the PNG format and the -pdf switch to produce a multi-page PDF file. The script automatically detects whether digiKam uses the SQLite or MySQL database back end, so you don’t need to do anything beyond running the script with the switch you want, for example: ./ -png


Tech writer covering Linux and open source software

Tagged with: , , , ,
Posted in Open Source, Photography, Software
6 comments on “Use the Focal Length Analyzer Script with digiKam
  1. mutlu says:

    Well, this sounds great, but it does not find the digikam config file and refuses to run:

    $ ./ -pdf
    Cannot find Digikam config file (digikamrc)

  2. mutlu says:

    I have to add that it does work, if I remove the entire if & else clause around the line

    It seems that, for some reason, while kde-config is available, it does not point to the correct directory?

  3. mutlu says:

    Nifty script, btw. Thanks a lot for it, it will prove very useful.

  4. hehe23 says:

    This promises to be very useful, but I can not run the script.

    $ ./ -pdf
    ./ line 62: [: ==: unary operator expected
    ./ line 67: [: ==: unary operator expected
    ./ line 86: select distinct model from ImageMetadata: command not found

    It seems that there is a syntax error? The lines in question are:
    62: if [ $DBTYPE == “QSQLITE” ]; then
    67: elif [ $DBTYPE == “QMYSQL” ]; then
    86: $SQLCOMMAND ‘select distinct model from ImageMetadata’ >$MODELS # List of identified camera models

    Note: I’m running openSuse 11.4 with digikam 1.8 version. The database type is QSQLITE

  5. Mike Bing says:

    Same issue as hehe23 on PCLinuxOS 2011.6

  6. Leon says:

    The script would be a nice addition to Digikam, but it hangs at the mktemp command:

    $ myscripts/ -png
    Backend is SQLite
    mktemp: invalid option — ‘-‘
    Usage: mktemp [-V] | [-dqtu] [-p prefix] [template]
    myscripts/ line 88: $MODELS: ambiguous redirect
    sed: no input files

    Even if I modify the script changing the arguments after ‘mktemp’ the temp file can still not be created.

    Any tips to get this to work?

Comments are closed.

Recipes for automated and streamlined photographic workflow on Linux

Use digiKam? Get this book!

Practical advice for nighttime photography

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

%d bloggers like this: