Merge XMP and IPTC tags?

Started by Archive, May 12, 2010, 08:54:25 AM

Previous topic - Next topic

Archive

[Originally posted by holyspidoo on 2008-09-27 23:10:35-07]

This tool is wonderful, but I'm having a bit of trouble finding the exact command to merge (sync) the XMP and IPTC tags.

What I want to do: Say I have picture X.jpg.

It has -Keywords: potato and it has -Subject veggie.

I'm trying to come up with a command that will let me sync those so that I havE:

-Keywords: potato, veggie
-Subject: potato, veggie

Any help? Thank you

Archive

[Originally posted by exiftool on 2008-09-28 12:10:52-07]

There are a few possibilities.  In a single step, you could do this:

Code:
exiftool "-keywords+<subject" "-subject+<keywords" image.jpg

which would result in

Keywords: potato, veggie

Subject: veggie, potato

Or, in two steps, you could do this:

Code:
exiftool "-keywords+<subject" image.jpg
 exiftool "-subject<keywords" image.jpg

which would give "potato, veggie" for both keywords and subject.

But it gets more complicated if the two sets overlap.  For example,
if you start with something like this:

Keywords: potato, soup

Subject: veggie, soup

Then things are a bit more complicated if you want to avoid duplicate
entries in the resulting lists:

Code:
exiftool -addtagsfromfile @ "-keywords-<subject" "-keywords+=subject" image.jpg
 exiftool "-subject<keywords" image.jpg

which gives "potato, veggie, soup" for both keywords and subject.

Also, it would be a good idea to specify "iptc:keywords" and "xmp:subject"
instead of just "keywords" and "subject" throughout.  This will avoid potential
conflicts with other tags of the same name (like "xmp-pdf:keywords" for
example).

I imagine this may be more than you bargained for with your initial
question, but there you go. https://exiftool.org/forum/Smileys/default/smiley.gif" alt="Smiley" border="0" />

- Phil

Archive

[Originally posted by exiftool on 2008-09-28 12:39:02-07]

I made a mistake in my last example.  It should have been:

Code:
exiftool -addtagsfromfile @ "-keywords-<subject" "-keywords<=subject" image.jpg
 exiftool "-subject<keywords" image.jpg

I had incorrectly typed "+=" instead of "<=" in the first line.

- Phil

Archive

[Originally posted by holyspidoo on 2008-09-28 13:48:58-07]

Thank you very much, that last one gives me an error though, says Error opening file Subject

Code:
(whereas "+=" instead of "<=" did not give errors, but didnt give the right results either)

Archive

[Originally posted by exiftool on 2008-09-28 17:23:32-07]

Sorry.  Apparently I wasn't very awake this morning.  Of course
it should be "+&lt" as in the other commands.

- Phil

Archive

[Originally posted by holyspidoo on 2008-09-29 12:47:13-07]

Thank you.

 Is it possible that the minus thing doesnt work? I say this because although these two commands work without errors, They do cause the duplicate problem if a tag is present in both XMP and IPTC.

Archive

[Originally posted by exiftool on 2008-09-29 14:20:40-07]

It is possible.  The -addTagsFromFile option is relatively new,
and it is possible that there are some bugs to work out.  First, let's be
you are using -addTagsFromFile and not -tagsFromFile.
If so, I can sort out the problem if you show me the exact command line
you are using and the relevant tags in the original file.  That should be
enough, but I may need to see the file itself if I can't replicate the problem.

- Phil

Archive

[Originally posted by holyspidoo on 2008-09-29 14:51:39-07]

I type this exactly:

Code:
exiftool -addtagsfromfile @ "-keywords-<subject" "-keywords+<subject" image.jpg exiftool "-subject<keywords" image.jpg
Tags: potato, soup AND veggie, soup. Result: potato, soup, veggie, soup
It adds the keywords correctly, but does not substract them so I end up with duplicate keywords in both xmp and iptc. Ultimately, I wish to make a batch file that will "unite" all the tags from a picture so that all my different photo applications will see them correctly. Thanks.

Archive

[Originally posted by exiftool on 2008-09-29 14:57:04-07]

I just thought of something.  Did you add the original
keywords separately?  This is the correct way to add
keywords:

Code:
exiftool -keywords=potato -keywords=soup image.jpg

This is wrong:

Code:
exiftool -keywords="potato, soup" image.jpg

and would result in the behaviour you are seeing.

- Phil

Archive

[Originally posted by holyspidoo on 2008-09-29 16:18:37-07]

That was EXACTLY the problem! In order to do tests, I entered the keywords in the batchfile the wrong way. Everything works. A million gazillion thanks!!