Bulk metadata edit

Started by Kelly, October 12, 2023, 07:02:54 AM

Previous topic - Next topic

Kelly

Hi,

Apologies if this has been asked before but I've searched for answers and come to a dead end.
I have run ~300,000 camera trap images through an AI software that has produced a csv file with image metadata (file name, data/time, species names etc.), and I'm now hoping to add the species names as tags/keywords to the image metadata.
Is it possible to use exiftool to add multiple rows of data (species names) from this file to image metadata?
Thank you.
Kelly.

StarGeek

See the -csv option and FAQ #26, "How do I import information from a database?"

You have to set the CSV up the same way exiftool output the data, with the header on the first column named "SourceFile".  That column needs a path to the file name, either relative to the current path or an absolute path.  Then then headers of the following columns are named for the tag you want to write.  In the case of keywords, if there are multiple entries, you would use the -sep option to make sure the keywords are separated correctly when writing

For example, here's a CSV file which will write two keywords to the XMP:Subject tag (XMP:Subject is the most modern standard place to write keywords, see the IPTC Photo Metadata Standard, Keywords)
SourceFile,Subject
y:/!temp/Test3.jpg,"Zebra, Elephant"
y:/!temp/Test4.jpg,"Beaver, Skunk"

You would write the data with a command like this
C:\>exiftool -P -overwrite_original -sep ", " -csv=y:\!temp\file.csv y:\!temp\Test3.jpg y:\!temp\Test4.jpg
    2 image files updated

C:\>exiftool -G1 -a -s -subject y:\!temp\Test3.jpg y:\!temp\Test4.jpg 
======== y:/!temp/Test3.jpg
[XMP-dc]        Subject                         : Zebra, Elephant
======== y:/!temp/Test4.jpg
[XMP-dc]        Subject                         : Beaver, Skunk
    2 image files read

Take note of the fact that I had to list the filenames as part of the command (you can mix/match multiple filenames and directories in a command).  The CSV file is not a list of files to edit, it is a lookup table where, for each file that exiftool is processing, it checks against the CSV list for any edits to make.
"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype