[digiKam-users] batch process for tagging

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

[digiKam-users] batch process for tagging

Fabiola Iannarilli
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
Reply | Threaded
Open this post in threaded view
|

Re: batch process for tagging

digikam-2
On Thu, 6 Sep 2018 15:10:47 -0500
Fabiola Iannarilli <[hidden email]> wrote:

> I am using digikam to process camera trap pictures and add
> information on the species 'captured' as EXIF data using tags.
>
[...]

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

I don't know about DK but exiftool will do it:

exiftool '-filename<${model;} ${datetimeoriginal}' -d "%Y-%m-%d-%H.%M.%S%.%%e" /directory/filename.ext

(watch for the wrap)

will give "Canon 7d 2018-09-06-12:01:32.cr2"

see http://u88.n24.queensu.ca/exiftool/forum/index.php/topic,2961
(Phil Harvey himself)

--
sknahT

vyS
Reply | Threaded
Open this post in threaded view
|

Re: batch process for tagging

digikam-2
On Thu, 6 Sep 2018 14:20:14 -0700
[hidden email] wrote:

> On Thu, 6 Sep 2018 15:10:47 -0500
> Fabiola Iannarilli <[hidden email]> wrote:
>
> > I am using digikam to process camera trap pictures and add
> > information on the species 'captured' as EXIF data using tags.
> >  
> [...]
>
> >
> > 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?  
>
> I don't know about DK but exiftool will do it:
>
> exiftool '-filename<${model;} ${datetimeoriginal}' -d
> "%Y-%m-%d-%H.%M.%S%.%%e" /directory/filename.ext

Oops correction! this should be:

exiftool '-filename<${model;}-${filenumber}.%e'  /directory/files

>
> (watch for the wrap)
>
> will give "Canon 7d 2018-09-06-12:01:32.cr2"
>
> see http://u88.n24.queensu.ca/exiftool/forum/index.php/topic,2961
> (Phil Harvey himself)
>
> --
> sknahT
>
> vyS


--
sknahT

vyS
Reply | Threaded
Open this post in threaded view
|

Re: batch process for tagging

Remco Viëtor
In reply to this post by Fabiola Iannarilli
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.