ExifTool Forum

ExifTool => The "exiftool" Application => Topic started by: JPED on March 27, 2014, 02:42:45 PM

Title: metadata copying problem - a little help needed
Post by: JPED on March 27, 2014, 02:42:45 PM
Hi All,

I am new to ExifTool and have a particular photo metadata 'thing' I would like to achieve.

I am using windows photo gallery to Face Tag my photos before sending them to photo cloud land (smugmug).

Using ExifTool I can see that Windows Photo Gallery puts the names of the face tagged People in the Xmp Tag named RegionPersonDisplayName e.g.  Joe*Jim*Charlie

What I would like to do is append this tag data onto the Exif Tag named XPKeywords so that XPKeywords will contain Joe;Jim;Charlie

Today, I spent a couple of hours looking at faqs and documentation.  I know ExifTool can do this and I even think I can see some general approaches but .... what I would really like to know is what is the simplest way of doing it?

I would want to process whole directories of photos in one go.

Btw, the reason I want to do this is because smugmug has a useful feature for dynamically searching for and retrieving photos based on XPKeywords so they can be displayed in what they term a "Smart Gallery"  ( a virtual gallery based on a query ).

Thanks in advance for any suggestions.

Regards,

JP.
Title: Re: metadata copying problem - a little help needed
Post by: Phil Harvey on March 27, 2014, 02:54:00 PM
Hi JP,

This is a bit tricky if you want to add the names to any XPKeywords that may already exist.

To overwrite existing XPKeywords, you would do this:

exiftool "-xpkeywords<regionpersondisplayname" -sep ";" DIR

(where DIR is the name of the directory containing the images.)

To add to existing XPKeywords, this is the command:

exiftool "-xpkeywords<$xpkeywords;$regionpersondisplayname" -sep ";" DIR

But the above command will fail if XPKeywords doesn't already exist.

To handle both cases (XPKeywords already existing, and not already existing), you would do this:

exiftool "-xpkeywords<regionpersondisplayname" "-xpkeywords<$xpkeywords;$regionpersondisplayname" -sep ";" DIR

In this command, the second argument will override the first for files where XPKeywords already exists.

- Phil
Title: Re: metadata copying problem - a little help needed
Post by: JPED on March 27, 2014, 03:07:18 PM
Hi Phil,

Thank you so much for your detailed, speedy and helpful reply.  I will give it a try.

Regards,

JP.
Title: Re: metadata copying problem - a little help needed
Post by: LiveFreeDead on June 09, 2017, 08:08:05 PM
I am trying to achieve similar results, but I am wanting to combine my existing keywords with the new Face tags BUT I don't want duplicates, I want to do this without having to run 2 passes, here is what I am trying but it's failing:

exiftool "-xpkeywords<regionpersondisplayname" "-xpkeywords<{$xpkeywords;$regionpersondisplayname};NoDups" -sep ";" D:\Documents\Desktop\FaceTags

Without the ;NoDups and {} added it will combine and have all keywords but the duplicates persist (of course).

If I have to run 2 passes it will take too long as my collection is hundreds of thousands of image files. I am moving to lightroom and want to still be able to search for the people I have already tagged in WLPG.

-EDIT-

exiftool -addtagsfromfile @ "-IPTC:Keywords-<EXIF:XPKeywords" -sep ";" "-IPTC:Keywords+<EXIF:XPKeywords" -sep ";" "-IPTC:Keywords-<XMP:regionpersondisplayname" -sep "*" "-IPTC:Keywords+<XMP:regionpersondisplayname" -sep "*" D:\Documents\Desktop\FaceTags

I have tried many many combinations of the above to stop duplicates, but all that manages to do is change the separator between each action and not split the string into a list instead of a string. I don't know how to go about this.

I really want Lightroom to be able to use my Person Regions tag names from WLPG and thought the XPKeywords was the Lightroom used one.

-EDIT-

I think the best solution to all this (to remove complexities) would be a new flag instead of an argument -NoDups, this will enable ANY combination to build a string or list of keywords and then by using the current -sep setting that it split the string into a list (if required) and remove any duplicated strings. you may need another flag to stop future requests for other people tho -IgnoreCaps so that it will remove duplicates that have the same word with/without uppercase letters.

As I expect you to be a busy person I am currently going through my WLPG a person at a time and selecting all their images and adding keywords manually, so even if I don't get the benifit, I hope you consider adding it for future users.
Title: Re: metadata copying problem - a little help needed
Post by: Phil Harvey on June 10, 2017, 07:13:50 AM
You can do any arbitrary processing you want by creating a user-defined tag.  There are probably examples in this forum if you search for "UserDefined duplicate" or something like that.  I don't have time right now to get more specific.

- Phil
Title: Re: metadata copying problem - a little help needed
Post by: LiveFreeDead on June 10, 2017, 08:25:44 AM
Seems most people are using Linux/Bash scripts to do this (I am using Windows 10), as I stated above I was going do this manually, so I spent 5 hours straight doing the job one person at a time and adding their name to Keywords within WLPG, this updated the Keyword in the jpg files thus solving the problem of my Keywords getting Duplicates when I added People Region Lables to any existing XPKeywords section using my failed attempts above.

I hope you can find time to offer your own example on how to achieve this without needing to open Exiftool multiple times per file/directory, there is no rush to do so anymore, it will be very useful for any future jobs I do to know how tho and if you do I will be sure to adopt it into my work flow as I often use exiftool to do many advanced things automated, especially as it's able to clone date/data from the original files. I know how little time there is in a day, so thanks for your work and response so far.
Title: Re: metadata copying problem - a little help needed
Post by: Phil Harvey on June 10, 2017, 09:30:20 AM
Here is an example that returns duplicate keywords (https://exiftool.org/forum/index.php/topic,4137.msg19595.html#msg19595).  This could be easily modified to return the non-duplicates. 

Here is another example that shows some list manipulations. (https://exiftool.org/forum/index.php/topic,5417.msg26234.html#msg26234)

- Phil
Title: Re: metadata copying problem - a little help needed
Post by: LiveFreeDead on June 10, 2017, 09:37:24 AM
Thank you, I never realized you added so much power to this, I will make it do what I need and share it back with the community once tested.