Adding XMP MWG regions

Started by geada, January 25, 2024, 05:47:24 AM

Previous topic - Next topic

geada

Hi,

I'm trying to build a script to add (or create if they don't exist) XMP MWG Face Regions.
As an example, I have a file where using exiftool -xmp -b I get the following currently:

<?xpacket begin="´╗┐" id="W5M0MpCehiHzreSzNTczkc9d"?> <x:xmpmeta xmlns:x="adobe:ns:meta/" x:xmptk="XMP Core 5.1.2"> <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"> <rdf:Description rdf:about="" xmlns:xmp="http://ns.adobe.com/xap/1.0/" xmp:Rating="0" xmp:ModifyDate="2023-12-18T16:24:49+00:00"/> </rdf:RDF> </x:xmpmeta>

        <?xpacket end="w"?>

I then try to add a RegionInfo with the following command:
exiftool -RegionInfo+={AppliedToDimensions={W=6000,H=4000,Unit=pixel}, RegionList=[{Area={W=0.15,H=0.17,X=0.3,Y=0.4, Unit=normalized} ,Name=Pedro,Type=Face}]} DB_28260.JPG

However, it says:

Warning: Tag 'RegionInfo' does not exist
Nothing to do.

I know it doesn't exist but shouldn't this command create the tag? What am I doing wrong?

On another example, I'm just trying to add new face (a new RegionList) to a file that already has multiple RegionList objects. In that case, I'm trying to do this:

exiftool -RegionList+={Area={W=0.15,H=0.17,X=0.3,Y=0.4,Unit=normalized},Name=Pedro,Type=Face} DSCN0517.JPG

But again, I get the same type of output:
Warning: Tag 'RegionList' does not exist
Nothing to do.

Thanks for any feedback





geada

#1
Sorry for this. It seems I was using an older version of exiftool and that's why it wasn't working. Just for future reference for others, I did manage to:

Add a new RegionInfo on a file with no regions with:
exiftool -XMP-mwg-rs:RegionInfo={AppliedToDimensions={W=6000,H=4000,Unit=pixel}, RegionList=[{Area={W=0.15, H=0.17, X=0.3, Y=0.4, Unit=normalized}, Name=Pedro,Type=Face}]} DB_28260.JPG

And a new RegionList entry on a file that already had other RegionList entries with:
exiftool -XMP-mwg-rs:RegionList+={Area={W=0.15,H=0.17,X=0.3,Y=0.4, Unit=normalized}, Name=Pedro, Type=Face} DSCN0517.JPG

Phil Harvey

Glad you figured it out.

- 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 ($).

RhetTbull

This was very useful for helping to figure out how to write the face regions when using exiftool with -stay_open. If the region name contains special characters (for example a comma), is escaping necessary and if so, what's the format?

Phil Harvey

I see.  You want to escape values in a serialized structure.

Read here for details.

- 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 ($).