In Microsoft's Windows Photo Gallery – People Tags can contain an optional "rectangle" which identifies the person within the photo. Thus, if you run the following exiftool command:
exiftool .\190516-1705.JPG -RegionInfoMP -struct -json
the returned result is:
[{
"SourceFile": "./190516-1705.JPG",
"RegionInfoMP": {
"Regions": [{
"PersonDisplayName": "John",
"Rectangle": "0.554502, 0.164692, 0.063981, 0.095972"
},{
"PersonDisplayName": "Alice",
"Rectangle": "0.324219, 0.180539, 0.064063, 0.097304"
},{
"PersonDisplayName": "Mark",
"Rectangle": "0.456250, 0.273154, 0.058594, 0.087925"
},{
"PersonDisplayName": "Abraham"
}]
}
}]
In this particular example, Abraham has no Rectangle tag. So my question is - If there is a way using exiftool to list all of the jpg files with People Tags which have no ("rectangle tags") associated?
Something with an output (or similar) such as:
190516-1705.JPG Abraham
190516-1706.JPG Mark
190516-1706.JPG Alice
190516-1707.JPG Mark
Note that 190516-1706.JPG has two People Tags which meet this condition.
Reference:
Microsoft People Tags Schema: https://docs.microsoft.com/en-us/windows/desktop/wic/-wic-people-tagging#microsoft-photo-12-schema
Exiftool Microsoft MP Tags: https://exiftool.org/TagNames/Microsoft.html
Here is a config file that will allow you to list all faces without rectangles. The command could be something like this:
exiftool -config my.config -p "$filename $norectangle" -if "$norectangle" DIR
%Image::ExifTool::UserDefined = (
'Image::ExifTool::Composite' => {
NoRectangle => {
Require => 'RegionInfoMP',
ValueConv => q{
my @rtn;
foreach my $region (@{$val[0]{Regions}}) {
my $name = $$region{PersonDisplayName} or next;
push @rtn, $name unless $$region{Rectangle};
}
return undef unless @rtn;
return join ', ', @rtn;
},
},
},
);
%Image::ExifTool::UserDefined::Options = (
Struct => 1,
);
1;
- Phil
Thanks again Phil!
Using your config file I exported the output to a file which aided my analysis.
exiftool -config my.config -p "$filename; $norectangle" -if "$norectangle" -r DIR > NoRectangle.txt
- J Oliver