Scribbles and Snaps

Linux, Open Source, Photography

Archive for July 2011

digiKam Tricks 3.9.3 Released

with 2 comments

As the number version suggests, this is a minor release which features a handful of tweaks and corrections as well as improved compatibility with the Cool Reader app for Android.

Although attention in this release was focused on tweaks and fixes, the book includes the following new material:

  • Disable Certain File Types
  • Use the Focal Length Analyzer Script with digiKam

Readers who already purchased the book will receive the new version free of charge. If you haven’t received your copy, please send your order confirmation as proof of purchase to dmpop@linux.com, and I’ll email you the latest version of the book.

Happy reading!

Written by Dmitri Popov

2011/07/31 at 16:36

Quick Tip: A Simple Python Script to Launch digiKam

leave a comment »

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.

Written by Dmitri Popov

2011/07/25 at 14:37

Posted in Open Source, Scribbles, Software

Tagged with , , ,

Process Photos with digiKam’s Batch Queue Manager and a Bash Script

with 3 comments

One of digiKam’s lesser known features is the ability to link scripts to notifications. At first sight, this may seem like a rather obscure functionality, but it can be put to some clever uses. Say, you want to keep a portfolio of selected photos on a mobile device. Resizing multiple photos to a specified size to make it easier to view them on the mobile device and transferring the processed photos from digiKam to the mobile device manually is not very practical. And this is where the ability to trigger scripts via notifications can come in handy. You can attach a simple Bash script to the Batch queue completed notification, so it’s triggered automatically when the Batch Queue Manager tool is done processing photos.

The Bash script is very simple, indeed. It uses the rsync tool to copy the processed photos from the source directory (in this case, it’s /home/user/Photos/Processed) to the /DCIM/Camera directory on the mounted SD card:

#!/bin/bash
rsync -avz --delete /home/user/Photos/Processed /media/0CFA-5602/DCIM/Camera

Paste the code above into an empty text file and save it as a postprocess.sh file (don’t forget to replace the example paths with the actual paths to the source and destination directories). Make then the script executable using the chmod o+x postprocess.sh command.

In digiKam, choose Settings » Configure Notifications and select the Batch queue completed item. Tick the Run command check box, and enter the path to the postprocess.sh script in the appropriate field. As you might have guessed, this links the script to the notification, so the script is triggered as soon as the batch operation is finished.

Next, create a tag (e.g., transfer) in digiKam and assign it to the photos you want to transfer to the mobile device. Alternatively, you can use a specific color label for that. Use then the Filter right sidebar to display the tagged or labelled photos, select them, and press Ctrl+B (or choose Tools » Batch Queue Manager) to add them to a new batch queue. In the Queue Settings section, click on the Target tab and select the Photos » Processede sub-album. Under the Base Tools tab, double-click on the Transform » Resize tool to add it to the Assigned Tools section. In the Tool Settings pane, specify the desired length. You can choose between several presets, or enable the Use Custom Length option and specify the desired length.

Hit then the Run button, and once the batch operation is completed, the assigned Bash script copies the resized photos to the mounted SD card.

You can tweak the script to perform other post-processing actions, too. For example, if you use the llgal command-line tool to generate static HTML photo galleries, you can tweak the script to add the processed photos to an HTML album. The script may look something like this:

cd /home/user/Photos/Processed
llgal --exif --li -L --sx 800 --sy 600

In other words, you can do all kinds of clever tricks by linking scripts to notifications.

Written by Dmitri Popov

2011/07/11 at 08:20

digiKam Tricks 3.9 Released

leave a comment »

This release includes the following new material:

  • Import Photos in digiKam
  • Process Photos with digiKam’s Batch Queue Manager and a Bash Script

Readers who already purchased the book will receive the new version free of charge. If you haven’t received your copy, please send your order confirmation as proof of purchase to dmpop@linux.com, and I’ll email you the latest version of the book.

Happy reading!

Written by Dmitri Popov

2011/07/05 at 09:57

Follow

Get every new post delivered to your Inbox.

Join 374 other followers