[digiKam-users] batch process for tagging
Remco Viƫtor
remco.vietor at wanadoo.fr
Fri Sep 7 07:00:57 BST 2018
On jeudi 6 septembre 2018 22:10:47 CEST Fabiola Iannarilli wrote:
> Hi,
>
> I am using digikam to process camera trap pictures and add information on
> the species 'captured' as EXIF data using tags.
>
> I have a large number of camera sites (100 x season) coded with different
> names. The cameras I am using store every 1000 pictures in a different
> folder, so I have this directory structure:
>
> Camera_1
> folder_1 (1000 pics)
> folder_2 (1000 pics)
> folder_3 (1000 pics)
>
> Camera_2
> folder_1 (1000 pics)
> folder_2 (1000 pics)
> .....
>
> Is there a way to add the tags to all the pictures taken at a camera site
> (i.e., pictures in all the folders of that camera) using a batch process so
> that I can run it when I am not at the computer?
>
> Thank you for any suggestion,
> Fabiola
I don't see a way to do this from within digikam, as I don't see a way to use
part of the image path as a tag.
But if in your directory structure the "camera_1" etc. corresponds to a *site*
(and ideally has the site name as actual name), a bash script would be
possible.
What to use exactly depends on the file format. If the images are jpgs, I'd use
Exiv2 (or exiftool) to add/modify keyword tags (either using the directory
name or a lookup table), after making a complete backup.
If you are dealing with raw files, best go through a sidecar. Those use XML
format, but they are not XML files as they miss the proper headers. Something
like awk would allow you to add a tag on the proper place.
And of course, make a backup and test on a small subset (which should contain
several sites and image drectories): especially when dealing with sidecars,
small errors could make the sidecar file unreadable (not the image, it's not
touched).
Oh, and if you do this on an existing Digikam picture collection, don't forget
to reload the metadata from the images when you're done.
If "camera_1" etc. corresponds to different physical camera's which are moved
around (so one camera corresponds to several sites), things are getting
"interesting": there is no clear link to the site in your directory
structure... You can still use a batch file to add tags to newly imported
images
Remco
P.S. While doing such massive tagging through Digikam is going to be slow
(although you can tag a whole "camera_x" directory in one go), writing and
debugging the required script(s) is going to take time as well, usually more
time than initially expected.
More information about the Digikam-users
mailing list