user2164703
user2164703

Reputation: 209

Write Face Tags to XMP files (not embedded) as well as XMP metadata embedded in JPG

I have Face Tags data (Name of persons and X/Y and size of each boxes for each image) in my database.

I want to update the corresponding JPEG or XMP files with this information.

I'm aware about ExifTool but I dont see how to create this kind of list for each image.

I may use python or cmd prompt logic for that.

Note: I tried How to write WIC XMP people tags to jpg? Exiftools update the file, but the box/name wont show on any software (Photo,Lightroom,XnView) , even if I add keyword person as tag as well, the name appear in Explorer on People tab though.

Upvotes: 1

Views: 982

Answers (2)

Pablo Fraire
Pablo Fraire

Reputation: 1

You can do this using structured tags instead of many flat tags. (https://exiftool.org/struct.html)

This way you can set many regions for each image.

exiftool "-RegionInfo<=file" ./img.jpg

file:

{
    AppliedToDimensions =
    {
        W = 4000,
        H = 3000,
        Unit = pixel,
    },
    RegionList =
    [
        {
            Area =
            {
                W = 0.13375, H = 0.178333333, X = 0.19, Y = 0.075,
                Unit = normalized,
            },
            Name = Person 1,
            Type = Face,
        },
        {
            Area =
            {
                W = 0.13375, H = 0.178333333, X = 0.9775, Y = 0.114666667,
                Unit = normalized,
            },
            Name = Person 2,
            Type = Face,
        },
        {
            Area =
            {
                W = 0.13375, H = 0.178333333, X = 0.9775, Y = 0.808,
                Unit = normalized,
            },
            Name = Person 3,
            Type = Face,
        },
        {
            Area =
            {
                W = 0.13375, H = 0.178333333, X = 0.146, Y = 0.822,
                Unit = normalized,
            },
            Name = Person 4
            Type = Face,
        }
    ],
}

Upvotes: 0

user2164703
user2164703

Reputation: 209

Following the comment I did the following cmd line that solve it:

exiftool -xmp-mwg-rs:RegionAppliedToDimensionsH=4000 -xmp-mwg-rs:RegionAppliedToDimensionsUnit="pixel" -xmp-mwg-rs:RegionAppliedToDimensionsW=6000 -xmp-mwg-rs:RegionAreaX=0.319270833 -xmp-mwg-rs:RegionAreaY=0.21015625 -xmp-mwg-rs:RegionAreaW=0.165104167 -xmp-mwg-rs:RegionAreaH=0.30390625 -xmp-mwg-rs:RegionName=John -xmp-mwg-rs:RegionRotation=0 -xmp-mwg-rs:RegionType="Face" myfile.xmp

Upvotes: 2

Related Questions