ordering of commands

Started by tonymagnus, October 15, 2021, 12:13:02 AM

Previous topic - Next topic

tonymagnus

Wow what amazing software. I am a (70 year old) novice so please be easy on me :)

I have about 60,000 photos on Picasa that I have moved to Onedrive and find that face searching is confused by the countless locations for faces
I will still use Picasa to manage facial recognition

The one tag that is correct is xmp:RegionName so I made done a command line to move and overwrite that to EVERY other naming convention.


exiftool  "-xmp-dc:subject<xmp:RegionName" "-xpkeywords<xmp:regionname" "-xmp:regionpersondisplayname<xmp:regionname" "-xmp:lastkeywordxmp<xmp:regionname" "-xmp:categories<xmp:regionname" "-xmp:tagslist<xmp:regionname" "-XMP-lr:HierarchicalSubject <xmp:regionname" "-xmp:catalogsets<xmp:regionname" "-xmp:keywords<xmp:regionname" "-xmp:lastkeywordxmp<xmp:regionname" "-xmp:lastkeywordiptc<xmp:regionname" "-xmp-mediapro:people<xmp:regionname" -overwrite_original  -r "P:\PICTURES\pic test\img218.jpg"

Then the obstacle was that if the RegionName was blank, it would NOT overwrite the other tags so this small command below just appends a space to regionname (ie if it was blank it now has a space character and that WILL copy

exiftool "-xmp:RegionName+= " "P:\PICTURES\pic test\img218.jpg"

I have tried embedding just the command "-xmp:RegionName+= " into the bigger command but I cant work out how to do that FIRST - whether its at the start or the end it changes region name but not i the order that everything else has the new name  ...  and i need to run it a second time to them move the "new" region name into all other fields

am i doing something very wrong?

cheers  from Australia


Phil Harvey

I don't think that adding a space is the right thing to do.  Instead, clear the values of the other tags before copying xmp:regionname:

exiftool -xmp-dc:subject= -xpkeywords= -xmp:regionpersondisplayname= -xmp:lastkeywordxmp= -xmp:categories= -xmp:tagslist= -XMP-lr:HierarchicalSubject= -xmp:catalogsets= -xmp:keywords= -xmp:lastkeywordxmp= -xmp:lastkeywordiptc= -xmp-mediapro:people= "-xmp-dc:subject<xmp:RegionName" "-xpkeywords<xmp:regionname" "-xmp:regionpersondisplayname<xmp:regionname" "-xmp:lastkeywordxmp<xmp:regionname" "-xmp:categories<xmp:regionname" "-xmp:tagslist<xmp:regionname" "-XMP-lr:HierarchicalSubject<xmp:regionname" "-xmp:catalogsets<xmp:regionname" "-xmp:keywords<xmp:regionname" "-xmp:lastkeywordxmp<xmp:regionname" "-xmp:lastkeywordiptc<xmp:regionname" "-xmp-mediapro:people<xmp:regionname" -overwrite_original -r "P:\PICTURES\pic test\img218.jpg"

Or it may be easier to use an argfile instead of having such a long command line:

-xmp-dc:subject=
-xpkeywords=
-xmp:regionpersondisplayname=
-xmp:lastkeywordxmp=
-xmp:categories=
-xmp:tagslist=
-XMP-lr:HierarchicalSubject=
-xmp:catalogsets=
-xmp:keywords=
-xmp:lastkeywordxmp=
-xmp:lastkeywordiptc=
-xmp-mediapro:people=
-xmp-dc:subject<xmp:RegionName
-xpkeywords<xmp:regionname
-xmp:regionpersondisplayname<xmp:regionname
-xmp:lastkeywordxmp<xmp:regionname
-xmp:categories<xmp:regionname
-xmp:tagslist<xmp:regionname
-XMP-lr:HierarchicalSubject<xmp:regionname
-xmp:catalogsets<xmp:regionname
-xmp:keywords<xmp:regionname
-xmp:lastkeywordxmp<xmp:regionname
-xmp:lastkeywordiptc<xmp:regionname
-xmp-mediapro:people<xmp:regionname
-overwrite_original
-r


then

exiftool -@ myargfile.args "P:\PICTURES\pic test\img218.jpg"

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

StarGeek

Quote from: tonymagnus on October 15, 2021, 12:13:02 AM
I have moved to Onedrive and find that face searching is confused by the countless locations for faces

Interesting, I didn't know that OneDrive had the ability to deal with facial recognition tags.

Quoteexiftool  "-xmp-dc:subject<xmp:RegionName" ...

One really big thing to watch out for here.  You're using the wrong quotes.  If you look closely, you'll see that these are fancy quotes " ".  On the command line, you must use regular straight quotes ".  So something in your workflow is "helping" you by changing the quotes.  On a Mac, this can happen automatically, as there's a setting for this.  Otherwise, make sure you're not copy/pasting commands while using a word processer such as Word or Google Docs.

QuoteThen the obstacle was that if the RegionName was blank, it would NOT overwrite the other tags so this small command below just appends a space to regionname (ie if it was blank it now has a space character and that WILL copy

exiftool "-xmp:RegionName+= " "P:\PICTURES\pic test\img218.jpg"

There's another big problem with this.  For most of the tags you list, it is not appending a space character.  Most off the tags you list are List Type tags.  That means that each item is a complete, separate, self contained entry.  So what you're doing here is adding a new entry consisting of a single space.  Here's what the raw XMP data looks like in that case
  <dc:subject>
   <rdf:Bag>
    <rdf:li>Keyword One</rdf:li>
    <rdf:li>Keyword Two</rdf:li>
    <rdf:li> </rdf:li>
   </rdf:Bag>
  </dc:subject>


Exiftool will show list type tags as if they were a comma separated string, which is something a lot of programs do.  Phil's suggestion is a much better solution.

QuoteI have tried embedding just the command "-xmp:RegionName+= " into the bigger command but I cant work out how to do that FIRST - whether its at the start or the end it changes region name but not i the order that everything else has the new name  ...  and i need to run it a second time to them move the "new" region name into all other fields

To address this, for all practical purposes, you can't add a new value and then copy that new value to other tags in a single command.  You have to either set the value in one pass or included it as a separate action.  The latter case would look like this.  But Phil's solution is still better.
"-subject<RegionName" -Subject=" " "-lastkeywordxmp<Xmp:RegionName" -RegionName+=" "

With regards to all the tags you're copying to, this is massive overkill and most of these tags are not of much use.  Going down the list

xpkeywords This and other XP* tags (XPAuthor, XPComment, etc) are basically completely useless tags.  Windows is the only program that will ever read these tags and even then, it will read a more common tag.  In this case, you could set XMP:Subject and Windows will read data from that.

One additional problem is that it is a simple string tag instead of a list type tag and for Windows to read it properly, you have to use a semicolon to separate the individual entries.

LastKeywordIPTC/LastKeywordXMP These are two more Microsoft specific tags that I don't believe any program outside of a Microsoft one will use.  And apparently, OneDrive will automatically fill these out.  See here.  Side note, according to that post, OneDrive is "is not a backup".  So basically, you have to trust that Microsoft will not destroy some of the more complex tags, such as the MakerNotes, which are often broken or destroyed by programs that are not aware of them.  Picasa being one of them in the case of Nikon MakerNotes.

Categories/TagsList/CatalogSets/xmp-mediapro:people These are program specific tags, being used by ACDSee, DigiKam, and Phase One Media Pro respectively.  There's no need to fill out these tags unless you plan on using one of these programs.

XMP:Keywords  This is a PDF tag.  The full name is XMP-pdf:Keywords.  No reason to use this in an image.  A better target would be IPTC:Keywords, as this tag correspondences to the XMP:Subject tag, but in the older IPTC IIM/Legacy standard.

HierarchicalSubject This is a good tag to use if you are using a hierarchy.  For example, you could have a hierarchy of People->Family->Uncle Bob, which would be set as People|Family|Uncle Bob.  But if you don't have a hierarchy set up, there's not much use in setting this tag.  This tag was original created for use in Adobe LightRoom and has been adopted by other programs, so it can be useful.

RegionPersonDisplayName  Now this is a more complex tag and might be useful to set, but not on it's own.  It is part of a larger set of tags which holds the names and the dimensions of the face regions.  It is part of the Microsoft regions tags and the Microsoft version of the MWG region tags used by Picasa.  It was originally used by the now defuct Windows Live Photo Gallery and it's quite possible that OneDrive will read these regions.  What you would be better off doing would be to convert the MWG regions into the Microsoft regions.

To do this, you would want to download the convert_regions.config from GitHub.  Save it in either the same directory as exiftool or some place you can remember the full path for it. Then you would run this command
exiftool -config convert_regions.config "-RegionInfoMP<MWGRegion2MPRegion" /path/to/files/
Put the full path to the config file if it's not in the same directory as exiftool.

This will create Microsoft regions in the file that are the equivalent to the MWG regions already there.
* 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).

Phil Harvey

Wow!  That can be a whole chapter in your book, StarGeek. ;)

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

tonymagnus

thanks guys - that is brilliant advice.
Australia has been in lockdown so the big plus is the time i have had to sort out such issues.