Digikam/Batch Queue Manager and Script: Difference between revisions
(Created page with "== Process Photos with digiKam’s Batch Queue Manager and a Bash Script == Transcribed from Dmitri Popov's blog, 11 July 2011 One of '''digiKam’s''' lesser known features is ...") |
m (fix statement) |
||
(2 intermediate revisions by one other user not shown) | |||
Line 1: | Line 1: | ||
== Process Photos with digiKam’s Batch Queue Manager and a Bash Script == | <languages /> | ||
<translate> | |||
== Process Photos with digiKam’s Batch Queue Manager and a Bash Script == <!--T:1--> | |||
Transcribed from Dmitri Popov's blog, 11 July 2011 | Transcribed from Dmitri Popov's blog, 11 July 2011 | ||
<!--T:2--> | |||
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 [http://en.wikipedia.org/wiki/Bash_(Unix_shell) Bash] script to the Batch queue completed notification, so it’s triggered automatically when the ''Batch Queue Manager'' tool is done processing photos. | 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 [http://en.wikipedia.org/wiki/Bash_(Unix_shell) Bash] script to the Batch queue completed notification, so it’s triggered automatically when the ''Batch Queue Manager'' tool is done processing photos. | ||
<!--T:3--> | |||
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: | 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: | ||
<!--T:4--> | |||
{{Input|1= | {{Input|1= | ||
#!/bin/bash | #!/bin/bash | ||
Line 11: | Line 17: | ||
}} | }} | ||
<!--T:5--> | |||
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 <code>chmod o+x postprocess.sh</code> command. | 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 <code>chmod o+x postprocess.sh</code> command. | ||
<!--T:6--> | |||
[[Image:Digikam_notificationscript.png|center|500px]] | [[Image:Digikam_notificationscript.png|center|500px]] | ||
In '''digiKam''', choose <menuchoice>Settings -> Configure Notifications</menuchoice> and select the <menuchoice>Batch queue completed</menuchoice> item. Tick the <menuchoice>Run</menuchoice> | <!--T:7--> | ||
In '''digiKam''', choose <menuchoice>Settings -> Configure Notifications</menuchoice> and select the <menuchoice>Batch queue completed</menuchoice> item. Tick the <menuchoice>Run command</menuchoice> 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. | |||
<!--T:8--> | |||
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 <menuchoice>Filter</menuchoice> right sidebar to display the tagged or labelled photos, select them, and press <keycap>Ctrl + B</keycap> (or choose <menuchoice>Tools -> Batch Queue Manager</menuchoice>) to add them to a new batch queue. In the <menuchoice>Queue Settings</menuchoice> section, click on the <menuchoice>Target</menuchoice> tab and select the <menuchoice>Photos -> Processed</menuchoice> sub-album. Under the <menuchoice>Base Tools</menuchoice> tab, double-click on the <menuchoice>Transform -> Resize</menuchoice> tool to add it to the <menuchoice>Assigned Tools</menuchoice> section. In the <menuchoice>Tool Settings</menuchoice> pane, specify the desired length. You can choose between several presets, or enable the <menuchoice>Use Custom Length</menuchoice> option and specify the desired length. | 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 <menuchoice>Filter</menuchoice> right sidebar to display the tagged or labelled photos, select them, and press <keycap>Ctrl + B</keycap> (or choose <menuchoice>Tools -> Batch Queue Manager</menuchoice>) to add them to a new batch queue. In the <menuchoice>Queue Settings</menuchoice> section, click on the <menuchoice>Target</menuchoice> tab and select the <menuchoice>Photos -> Processed</menuchoice> sub-album. Under the <menuchoice>Base Tools</menuchoice> tab, double-click on the <menuchoice>Transform -> Resize</menuchoice> tool to add it to the <menuchoice>Assigned Tools</menuchoice> section. In the <menuchoice>Tool Settings</menuchoice> pane, specify the desired length. You can choose between several presets, or enable the <menuchoice>Use Custom Length</menuchoice> option and specify the desired length. | ||
<!--T:9--> | |||
Hit then the <menuchoice>Run</menuchoice> button, and once the batch operation is completed, the assigned Bash script copies the resized photos to the mounted SD card. | Hit then the <menuchoice>Run</menuchoice> button, and once the batch operation is completed, the assigned Bash script copies the resized photos to the mounted SD card. | ||
<!--T:10--> | |||
You can tweak the script to perform other post-processing actions, too. For example, if you use the [http://home.gna.org/llgal/ 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: | You can tweak the script to perform other post-processing actions, too. For example, if you use the [http://home.gna.org/llgal/ 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: | ||
<!--T:11--> | |||
{{Input|1= | {{Input|1= | ||
cd /home/user/Photos/Processed | cd /home/user/Photos/Processed | ||
llgal --exif --li -L --sx 800 --sy 600}} | llgal --exif --li -L --sx 800 --sy 600}} | ||
<!--T:12--> | |||
In other words, you can do all kinds of clever tricks by linking scripts to notifications. | In other words, you can do all kinds of clever tricks by linking scripts to notifications. | ||
<!--T:13--> | |||
[[Category:Graphics]] | |||
[[Category:Photography]] | |||
[[Category:Tutorials]] | |||
</translate> |
Latest revision as of 15:45, 13 July 2011
Process Photos with digiKam’s Batch Queue Manager and a Bash Script
Transcribed from Dmitri Popov's blog, 11 July 2011
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 and select the item. Tick the 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 Ctrl + B (or choose ) to add them to a new batch queue. In the section, click on the tab and select the sub-album. Under the tab, double-click on the tool to add it to the section. In the pane, specify the desired length. You can choose between several presets, or enable the option and specify the desired length.
right sidebar to display the tagged or labelled photos, select them, and pressHit then the
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.