ExifTool Forum

ExifTool => Newbies => Topic started by: Taggin on May 01, 2020, 07:18:21 PM

Title: Append metadata on all images based on csv with multiple entries
Post by: Taggin on May 01, 2020, 07:18:21 PM
If you have a collection of JPG images and a csv file containing the filenames and persons name. How do you tag the persons name to the image, especially when there is more than 1 person on the pictures.


SourceFile,Subject
Picture0001.JPG,Adam Able
Picture0002.JPG,Barbara Bubles
Picture0001.JPG,Charly Brown



When I use exiftool -csv+=people.csv .
It doesn't write all persons to the image, but only the last one in csv file.
For example for Picture0001.JPG it only writes "Charly Brown" , but it should write "Adam Able; Charly Brown".



Append: Is there a correct metadata field for persons in jpg picture? I want to search through the pictures metadata in Windows Explorer and Adobe Lightroom. For example: search in Winodws Explorer Folder for "Adam Able" and it shows all photos with him or import the jpgs into Lightroom and it imports the peoples names too.
Title: Re: Append metadata on all images based on csv with multiple entries
Post by: StarGeek on May 01, 2020, 07:48:58 PM
Phil would have to verify but I'd assume that because the way exiftool has to process a csv, the latter entry is overriding the earlier entry.  You'd have to put in the same cell like this
Picture0001.JPG,"Adam Able, Charly Brown"
and then use the -sep option (https://exiftool.org/exiftool_pod.html#sep-STR--separator) (-sep ", ") to make sure they get separated into separate entries.  The quotes around the comma indicate that it's part of that cell and not a place to separate into a new column.

Quote from: Taggin on May 01, 2020, 07:18:21 PMAppend: Is there a correct metadata field for persons in jpg picture? I want to search through the pictures metadata in Windows Explorer and Adobe Lightroom.

There is region name tags for use with facial recognition data. I think LR supports it, though I don't know how searchable it may be.  I'm fairly certain that Windows will not read it.  You would use RegionName for the tag.  It's part of the MWG RegionInfo (https://exiftool.org/TagNames/MWG.html#Regions) structure.

In order to search for that data with Windows, Subject would probably be the best place.
Title: Re: Append metadata on all images based on csv with multiple entries
Post by: Taggin on May 01, 2020, 08:14:22 PM
Quote from: StarGeek on May 01, 2020, 07:48:58 PM
Phil would have to verify but I'd assume that because the way exiftool has to process a csv, the latter entry is overriding the earlier entry.  You'd have to put in the same cell like this
Picture0001.JPG,"Adam Able, Charly Brown" and then use the -sep option (https://exiftool.org/exiftool_pod.html#sep-STR--separator) (-sep ", ") to make sure they get separated into separate entries.  The quotes around the comma indicate that it's part of that cell and not a place to separate into a new column.
Ufff. The csv has 30.000 lines and I don't know how to merge the keywords with a formular.  :-\
Title: Re: Append metadata on all images based on csv with multiple entries
Post by: Phil Harvey on May 01, 2020, 09:00:30 PM
Quote from: StarGeek on May 01, 2020, 07:48:58 PM
Phil would have to verify but I'd assume that because the way exiftool has to process a csv, the latter entry is overriding the earlier entry.

Yes.  ExifTool expects the file names in the first column to be unique.  If they aren't, subsequent entries will override earlier ones with the same SourceFile.

I can't think of any easy way offhand to do what you want other than writing a simple script to preprocess the .csv file.  I could process this for you if you want to send me the .csv (philharvey66 at gmail.com).

- Phil
Title: Re: Append metadata on all images based on csv with multiple entries
Post by: StarGeek on May 01, 2020, 10:25:29 PM
I did find this video (https://youtu.be/JJG024lYZzk?t=140) that seems to have a way to merge duplicate rows.
Title: Re: Append metadata on all images based on csv with multiple entries
Post by: Taggin on May 02, 2020, 10:21:49 AM
Thank You guys, the exiftool and forum are really outstanding!
It all worked out. I sorted it with Excel and the formulars shown in the video.
And appended person data in Subject field with exiftool.exe -csv+=people.csv -sep ", " -overwrite_original .

Awesome. :D