-XMP-mwg-rs:RegionName+= or -RegionName+=

Started by msavazzi, May 29, 2025, 01:56:18 PM

Previous topic - Next topic

msavazzi

I have several images JPG, HEIC, PNG, CR2 and I want to write metadata.
I'm confused on which one is better to use or both:
-XMP-mwg-rs:RegionName+=
or
-RegionName+=

If I have a sidecar XMP file for raw formats I think I should use -XMP-mwg-rs:RegionName+=
but for the others?

which is the best way?

I want to have the data available for Lightroom, Windows 11 properties and other apps.

and same question for the +Subject... for XMP files I think I have to add -use MWG
but for the others?

thank you for the help
M

StarGeek

Since there is only one writable tag called RegionName, you could use any of these
-RegionName+="Indiana Jones"
-XMP:RegionName+="Henry Jones, Sr."
-XMP-mwg-rs:RegionName+="Marion Ravenwood"

There is no difference between them.

Now, in my opinion, the best practice is to Keep It Simple. Use the simplest form of the tag name you can use. Use only the tag name, adding the group 0 name (XMP: IPTC: EXIF:) only if necessary to avoid collisions, such as XMP:Headline vs IPTC:Headline. Use the group 1 names only if absolutely necessary. And about the only time that is necessary is if you are trying to write a tag that is marked as Avoid.

If you are updating specific groups only, then you run into the possibility of fragmenting your data and making it out of sync for tags that use the same name. For example, if your file has XMP:Headline and IPTC:Headline tags, then specify that you're updating XMP:Headline means that IPTC:Headline will not get updated.

Also, writing to group 1 specific locations without a deep understanding of the metadata can lead to writing to incorrect locations.  As an example, some Sony cameras write the ModifyDate tag to the incorrect location (IFD1 instead of IFD0).  And unless you knew beforehand that this was incorrect, it would lead you to thinking that IFD1 was the correct location.  If you didn't include the specific group, exiftool would by default write to the correct location, as well as updating any other tag with the same name.

The Headline tag is also an example of when you might need to use a group 0 prefix. By default, exiftool will prefer IPTC tags over XMP tags with the same name. So if Headline didn't exist in the file and you wanted to add it, then using
-Headline="New headline"
would only write to IPTC:Headline. To write both, you would use
-Headline="New headline" -XMP:Headline="New headline"

An example of using a group 1 name would program specific tags. ACDSee tags are a good example. If you were using ACDSee, then you might want to write to XMP-acdsee:Author. Without the group 1 prefix, you would instead write to XMP-pdf:Author, which is obviously used for PDFs and not image files.

It's also important to take note of what groups the file can accept. The XMP sidecar file you mention can only take XMP tags, not EXIF or IPTC tags. So writing Headline to a XMP sidecar will automatically write to XMP:Headline because it can't write IPTC:Headline.
"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype

msavazzi

Ok so if I understood your suggestion correctly I should use only the -RegionName+= as it will go in any case in the XMP part of the data.

The other metadata I need to write are:
keywords
I can have -XMP-dc:keywords or -keywords

subject
I can have -XMP-dc:subjector or -keywords

HierarchicalSubject
I can have -XMP-lr:HierarchicalSubject or -HierarchicalSubject

for these ones which is better to use?
I would like to have IPTC and XMP aligned if applicable.
Probably for XMP sidecar files there is no IPCT by definition so I can use the first one.

M

Phil Harvey

RegionName is a "flattened" tag, meaning that the actual tag is part of a structure.  In this case it is the Name element of the MWG RegionStruct structure.  It doesn't really make sense to add or remove this tag without at least dealing with the Area defined by the region.

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

StarGeek

Quote from: msavazzi on May 29, 2025, 04:44:04 PMOk so if I understood your suggestion correctly I should use only the -RegionName+= as it will go in any case in the XMP part of the data.

You should use whatever makes you feel comfortable using. Some people might be more comfortable with the long version. But as many exiftool commands I've typed over the years, I've saved a lot by keeping it simple.


QuoteThe other metadata I need to write are:
keywords
I can have -XMP-dc:keywords or -keywords

This is the most difficult part. It's the fact that there are so many different tags, and it's hard to know the correct ones to write to.

There isn't an "XMP-dc:keywords" tag. The appropriate place to put keywords in XMP is Subject, specifically XMP-dc:Subject. If you try to write Keywords in XMP, you will end up writing XMP-pdf:Keywords, which is a PDF tag, not an image tag.

Keywords can be used by itself or as IPTC:Keywords. This writes to the legacy IPTC IIM tags.

Quotesubject
I can have -XMP-dc:subjector or -keywords

I'm assuming typos, but yes, you can write to Subject, XMP:Subject, or XMP-dc:Subject.

QuoteHierarchicalSubject
I can have -XMP-lr:HierarchicalSubject or -HierarchicalSubject

HierarchicalSubject is a LightRoom tag (thus the XMP-lr). Over the years since it's been introduced, other programs have also used it. It's meant to hold a pipe | separated hierarchy of tags.

An example from my own photos, taken at the San Diego Zoo and the Safari Park, where I could get specific animal names. This is how Imatch shows the hierarchy
IMatch2025x64-2025-05-29_19.14.04.png
And the tags would be
Animals|Bird|California Condor
Animals|Bird|Greater Sunbittern
Animals|Bird|Ibis|Hadada Ibis

But I believe that some programs are moving away from this tag and creating the hierarchy in the XMP-dc:Subject tag. I don't have a modern LightRoom so I do not know what LR currently does.

Quotefor these ones which is better to use?
I would like to have IPTC and XMP aligned if applicable.
Probably for XMP sidecar files there is no IPCT by definition so I can use the first one.

I would say Subject for sure. That is the modern location for keywords. You can add Keywords if you have programs that need to use IPTC IIM, but if all your programs read XMP, it's best to stick with that, IMO. HierarchicalSubject can be skipped unless you're using a program that will read it and you want to have a hierarchy for your keywords.
"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype

StarGeek

Quote from: Phil Harvey on May 29, 2025, 09:16:02 PMRegionName is a "flattened" tag, meaning that the actual tag is part of a structure.  In this case it is the Name element of the MWG RegionStruct structure.  It doesn't really make sense to add or remove this tag without at least dealing with the Area defined by the region.

Phil does have a point here. I've seen people use RegionName to hold the names of people in the image, so it didn't register with me.

If you want to put the names of people in the image, then PersonInImage (aka XMP-iptcExt:PersonInImage) would be the better place. Though the simpler option would be to add the names as keywords to Subject/Keywords.

The best tags to use are the ones that the programs you use can read.

The IPTC Photo Metadata Standard is also a good page to read over, as it lists the tags that are part of the standard and those are the tags most programs can read.
"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype

msavazzi

Quote from: StarGeek on May 29, 2025, 10:32:48 PM
Quote from: Phil Harvey on May 29, 2025, 09:16:02 PMRegionName is a "flattened" tag, meaning that the actual tag is part of a structure.  In this case it is the Name element of the MWG RegionStruct structure.  It doesn't really make sense to add or remove this tag without at least dealing with the Area defined by the region.

Phil does have a point here. I've seen people use RegionName to hold the names of people in the image, so it didn't register with me.

If you want to put the names of people in the image, then PersonInImage (aka XMP-iptcExt:PersonInImage) would be the better place. Though the simpler option would be to add the names as keywords to Subject/Keywords.

The best tags to use are the ones that the programs you use can read.

The IPTC Photo Metadata Standard is also a good page to read over, as it lists the tags that are part of the standard and those are the tags most programs can read.

In reality I've seen that multiple programs like Tonfotos and others use the Region Name for the name of the person, they use eve RegionType Face.
It's a good suggestion to ad
d it at PersonInImage... I'll check if I can do it :)


msavazzi

Done, I'm reading and writing PersonInImage too :) and use the Keywords only if IPCT data is present