Posts Tagged ‘scripts’
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 focalAnalyzer.sh 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: ./focalAnalyzer.sh -png
I store all my photos on a Linux server and mount the remote directory containing all the photos on my local machine using sshfs (see Manage Photos from Multiple digiKam Installations). This way, I can access my photos from multiple digiKam installations. This setup works like a charm, except for one thing: when I inadvertently launch digiKam before I mount the remote directory, the application doesn’t show photos from remote albums. What’s worse, after I mount the remote directory and restart digiKam, it takes the application a long time to rescan all remote albums. To fix this annoyance, I wrote a simple Python script:
#!/usr/bin/env python import os, wx path = '/home/dmpop/photos/' app = wx.PySimpleApp() if not os.listdir(path): message = wx.MessageDialog(None, "The remote share is not mounted.", "Error", wx.OK) message.ShowModal() message.Destroy() else: os.system("digikam")
The script checks whether the folder where the remote directory is mounted to (in this case, it’s /home/dmpop/photos/) is empty or not. If the directory is empty, the script displays an error message; otherwise it launches digiKam. For this script to work you need to install the python-wxversion package using the sudo apt-get install python-wxversion command on Ubuntu. Alternatively, you can modify the script to abort the operation instead of displaying an error message:
#!/usr/bin/env python import os, wx path = '/home/dmpop/photos/' if not os.listdir(path): sys.exit() else: os.system("digikam")
That’s all there is to it. Grab the script, make it executable using the chmod o+x digikam.py command, and assign a keyboard shortcut, and your custom digiKam launcher is ready to go.
You can emulate different vintage photo effects in GIMP, but usually this is a rather laborious and time-consuming process that requires some editing chops. Fortunately, the Film Imitation Lab (FIL) script lets you turn plain snaps into eye-popping vintage photos with a minimum of effort.
To install FIL on Linux, download the latest release of the script, unpack the downloaded archive, and move two .scm files from the resulting folder to the ~/.gimp.2.6/scripts directory. Some of the FIL script’s functionality depends on two plugins: Fix-CA and G’MIC. The Fix-CA script is distributed as a C source file, so you have to compile it yourself. To do this, install the required development library. On Debian and Ubuntu, this can be done by executing the following command as root:
apt-get install libgimp2.0-dev
Once the library has been installed, run the gimptool-2.0 –install fix-ca.c command to compile and install the Fix-CA plugin. Next, grab the G’MIC plugin for your platform, unpack the downloaded archive and move the gmic_gimp file from the resulting folder to the ~/.gimp.2.6/plugins directory. Launch GIMP and choose Filters » RSS » FIL check plugins to make sure that all the required plugins are installed properly. FIL is now ready to go. Open the desired photo in GIMP and launch FIL by choosing Filters » RSS » FIL.
The FIL script breaks photo processing into three stages: correcting color, adding grain, and applying vignetting. If specified, the script can also perform exposure correction, which is done prior to applying any effects.
The FIL dialog window lets you specify settings for each stage of the process. To apply color effects, tick the Colorcorrection stage check box and select the desired preset from the Color process drop-down list. To give the photo a distinctive vintage look, FIL lets you add grain to it. Enable the Grane stage option and select a grain type from the Grain process drop-down list. Which color process preset and grain type to choose depends on your taste and the given photo, and the best way to find out which combination works best for the current photo is to try them all.
Vignetting (dark corners at the edges of the photo) is often considered a problem, but it can also be used as a creative effect that draws attention to the main subject on the photo. To add vignetting to the photo using FIL, tick the Enable vignette check box and adjust the available parameters.
To make the vintage effect even more realistic, you can add a lens defect effect to the photo by enabling the Border blur feature which does exactly what its name says: it adds blur typical for defective or low-quality lenses to the borders of the photo.
Enabling the Write options in layer’s name option saves the selected color process preset and grain type as the name of the current layer. Choose, for example, the SOV: normal preset and the Sulfide: grunge grain type, and FIL sets the layer name to -c SOV: normal -g Sulfide: grunge. This feature can come in handy for keeping track of the settings you used for the given photo. If the current photo consists of several layers, make the layer you want to use with FIL visible and tick the Work with visible check box.
Once you’re happy with the settings, press the OK button and the script transforms the original image into a vintage photo based on the specified settings.
While you can use FIL to tweak individual photos, the script also allows you to batch process multiple images in one fell swoop. To process several photos, choose Filters » RSS » FIL Batch, specify the source and target directories, and tweak the settings for each stage. Alternatively, you can tick the Random mode check box. In this case, FIL will use random color process presets and grain types for each photo in the batch. Press OK and the script does the rest.