News:

2023-03-15 Major improvements to the new Geolocation feature

Main Menu

Updating Rating and Keywords tags on old photos (MSFT) to new standards

Started by Peterk, April 08, 2020, 03:01:19 PM

Previous topic - Next topic

Peterk

Hi,

Very useful tool, thank you.

I have a lot of old photos that have keywords and Rating information set in non standard ways.

I'm running the below on ALL my photos (including newer photos that do not have the issue) to put the information in the correct place per standard. I welcome any feedback if I'm doing it right or if there are any tweaks I should make.

1) Fix Keywords

exiftool.exe" -P -overwrite_original -sep ; "-keywords+<xpkeywords" -r <dir>

2) Fix rating information

exiftool.exe  -P -overwrite_original "-XMP-xmp:rating<IFD0:Rating" -r <dir>   (If XMP rating and IFD0 rating differ, I do want to copy, if IFD0 rating is blank, I do not want to overwrite any existing xmp rating)

I get a reasonable number (maybe 1 in 50 of the files)  "Warning: No writable tags set" - this I believe is simple just as it says, there are no tags on this file to write, so no problem.
I get the following warning on nearly every file: "Warning:[minor] Adjusted MakerNotes base by 4146 (or other number), that I think I can ignore (and suppress with the -m flag)
I get the occasional "Warning: [minor: Fixed incorrect URI for xmlns:Microsoftphoto." This one I also think I can ignore and suppress.

Thanks in advance for any feedback (btw, I'm in sales, not a programmer in any way, so simple is good!)

StarGeek

Your commands look good.  You'll get the "Warning: No writable tags set" when either the XPKeywords or the EXIF Rating tags are empty.  The one piece of advice is to use generic groups, XMP instead of XMP-xmp and EXIF instead of IFD0.  Exiftool will figure out the right place to put them and avoids possible errors in the case of misunderstanding where they should actually go.

The other two warnings can be safely ignored.
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

Peterk

Thank you very much.

I have a scenario where I have a directory of files, some with just EXIF Ratings, some with just XMP Ratings, and some with both.

I want to copy EXIF data to XMP, IF XMP is blank. Seems like it should be easy, but I can't figure out how to use -if to recognize a blank.

Something like

exiftool.exe "XMP:rating<IFD0:rating" test.jpg -if "XMP:rating eq 'empty'"

But of course empty searches for the text string empty, when what I want is to search for undefined.

How do I do that?

StarGeek

Quote from: Peterk on April 17, 2020, 10:45:22 AM
I want to copy EXIF data to XMP, IF XMP is blank. Seems like it should be easy, but I can't figure out how to use -if to recognize a blank.
...
But of course empty searches for the text string empty, when what I want is to search for undefined.

There are multiple ways to do this.  Normally, the simplest answer would be
-if "not $XMP:Rating"
but that's probably not the best answer here because if the rating is 0, then not 0 would return as true and the tag would overwrite the existing 0 rating

You could go with
-if "not defined $XMP:Rating"
this has the (probably) rare chance of not working in cases where XMP:Rating exists but has an empty value

or you could use the -wm (writemode) option and skip the -if with
-wm cg
which will write only new tags and will not overwrite existing values.  This also suffers from the same limitation in cases where the tag exists but has an empty value.
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

Peterk

In my case, none of the files have either EXIF or XMP rating of 0, so the simple way does work. Thanks!