digiKam/Керування пакетною обробкою та скрипти

From KDE UserBase Wiki
Revision as of 15:41, 13 July 2011 by Yurchor (talk | contribs) (Created page with "center|500px")
Other languages:

Обробка фотографій за допомогою керування пакетною обробкою digiKam та скрипту Bash

Створено на основі допису у блозі Дмітрія Попова (Dmitri Popov), 11 липня 2011 року

Однією з маловідомих можливостей digiKam є можливість прив’язки скриптів до сповіщень. З першого погляду ця можливість може здатися доволі незрозумілою, але вона може стати у великій пригоді. Наприклад, вам хочеться зберігати портфоліо вибраних фотографій на портативному пристрої. Зміна розмірів багатьох фотографій до вказаних розмірів для полегшення перегляду на портативному пристрої та надсилання оброблених фотографій з digiKam на портативний пристрій вручну є доволі обтяжливим заняттям. Тут і може знадобитися можливість використання певних скриптів на основі системи сповіщень. Ви можете пов’язати простий скрипт Bash зі сповіщенням про завершення пакетної обробки завдань, щоб цей скрипт було виконано щойно інструмент Керування чергою пакетної обробки повідомить про завершення обробки фотографій.

Наш скрипт Bash дуже простий. У ньому використано програму rsync для копіювання оброблених фотографій з каталогу походження (у нас /home/user/Photos/Processed) до кталаогу /DCIM/Camera на змонтованій картці SD:

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

Вставте код, наведений вище, до якогось текстового файла і збережіть його з назвою postprocess.sh (не забудьте замінити шляхи нашого прикладу на шляхи каталогів походження і призначення у вашій системі). Надайте створеному файлу право виконання командою chmod o+x postprocess.sh.



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 -> Processed 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

Іншими словами, можна організувати інтелектуальну обробку фотографій на основі прив’язок скриптів до сповіщень.