[digiKam-users] execute shell command on batch of images

Marc Palaus marcpalaus at hotmail.com
Tue Sep 6 16:43:27 BST 2022


Hi, It's definitely possible because I did that in the past, in order to 
correct some xmp metadata in some pictures.

That was a few years ago, but I remember it worked.

Basically, I created a bash script with the commands. Since we are 
working with several files, I created a loop like this one and put the 
desired command inside:

#!/bin/bash
echo "This is a sample script to be launched from Digikam"
# it just outputs the filenames
for var in "$@"
do
     echo "Processing file $var"
     #exiftool -XMP:All -TagsFromFile @ -XMP:all "$var" # Your command 
goes here. The picture filename is the $var variable.
done

Then, in Digikam, select the pictures to which you want to apply this 
command, right click, Open With..., Other, and in the prompt type:

xterm -hold -e /path/to/script/digikam_test_script.sh %U

You can use other terminal programs instead of xterm, of course, but 
then you have to figure out how to pass a command to it (for instance, 
in gnome-terminal it was something like: /usr/bin/gnome-terminal -- 
/path/to/script/digikam_test_script.sh.sh %U )

I hope it helps,

Marc

El 6/9/22 a les 10:09, Frederik Vanrenterghem ha escrit:
> Hi, I am trying to figure out if it's possible to run a command (git
> annex drop $file) on a bunch of images I've selected from within
> Digikam. (To be able to use its filtering to select.)
>
> The Batch Queue Manager has a User Shell Script tool, but I'm unclear
> how it needs to be used for the above. Does it launch the shell script
> in the folder of the images, and if not, how do I pass the image's
> location to the script?
>
> I tried creating a wrapper script git-annex-drop.sh and called that
> with /path/to/script/git-annex-drop.sh $INPUT, but that fails.
>
> Using latest digikam on Linux.
>
> Thx,
> Frederik


More information about the Digikam-users mailing list