"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "config_files/convert_regions.config" between
Image-ExifTool-12.26.tar.gz and Image-ExifTool-12.27.tar.gz

About: ExifTool is a platform-independent Perl library plus a command-line application for reading, writing and editing meta information in a wide variety of files.

convert_regions.config  (Image-ExifTool-12.26):convert_regions.config  (Image-ExifTool-12.27)
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# File: convert_regions.config # File: convert_regions.config
# #
# Description: User-defined Composite tag definitions to allow conversion of # Description: User-defined Composite tag definitions to allow conversion of
# face regions between Microsoft Windows Live Photo Gallery (WLPG) , # face regions between Microsoft Windows Live Photo Gallery (WLPG) ,
# Metadata Working Group (MWG), and IPTC Extension formats # Metadata Working Group (MWG), and IPTC Extension formats
# #
# Usage: 1) Convert from MP WLPG or IPTC regions to MWG regions: # Usage: 1) Convert from MP WLPG or IPTC regions to MWG regions:
# #
# exiftool -config convert_regions.config "-regioninfo<myregion" F ILE # exiftool -config convert_regions.config "-RegionInfo<MPRegion2MW GRegion" FILE
# #
# 2) Convert from MWG or IPTC to MP WLPG regions: # 2) Convert from MWG or IPTC to MP WLPG regions:
# #
# exiftool -config convert_regions.config "-regioninfomp<myregionm p" FILE # exiftool -config convert_regions.config "-RegionInfoMP<MWGRegion 2MPRegion" FILE
# #
# 3) Convert from MWG or MP WLPG to IPTC regions: # 3) Convert from MWG or MP WLPG to IPTC regions:
# #
# exiftool -config convert_regions.config "-imageregion<myregionip tc" FILE # exiftool -config convert_regions.config "-ImageRegion<MWGRegion2 IPTCRegion" FILE
# #
# Requires: ExifTool version 11.74 or later # Requires: ExifTool version 11.74 or later
# #
# Revisions: 2012/12/27 - P. Harvey Created # Revisions: 2012/12/27 - P. Harvey Created
# 2013/02/20 - PH Don't add ignored MP faces # 2013/02/20 - PH Don't add ignored MP faces
# 2017/02/13 - PH Handle MP regions without Rectangle or Name entr ies # 2017/02/13 - PH Handle MP regions without Rectangle or Name entr ies
# 2019/10/26 - PH Added support for the new IPTC ImageRegion # 2019/10/26 - PH Added support for the new IPTC ImageRegion
# 2021/05-27 - PH Changed a few tag names and added shortcuts for
# backward compatibility
# #
# References: http://www.metadataworkinggroup.org/specs/ # References: http://www.metadataworkinggroup.org/specs/
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
%Image::ExifTool::UserDefined = ( %Image::ExifTool::UserDefined = (
'Image::ExifTool::Composite' => { 'Image::ExifTool::Composite' => {
# create an MWG RegionInfo structure from a Microsoft RegionInfoMP struc ture # create an MWG RegionInfo structure from a Microsoft RegionInfoMP struc ture
MyRegion => { MPRegion2MWGRegion => {
Require => { Require => {
0 => 'RegionInfoMP', 0 => 'RegionInfoMP',
1 => 'ImageWidth', 1 => 'ImageWidth',
2 => 'ImageHeight', 2 => 'ImageHeight',
}, },
ValueConv => q{ ValueConv => q{
my ($rgn, @newRgns); my ($rgn, @newRgns);
foreach $rgn (@{$val[0]{Regions}}) { foreach $rgn (@{$val[0]{Regions}}) {
my $name = $$rgn{PersonDisplayName}; my $name = $$rgn{PersonDisplayName};
next unless $$rgn{Rectangle} or defined $name; next unless $$rgn{Rectangle} or defined $name;
skipping to change at line 72 skipping to change at line 74
push @newRgns, \%newRgn; push @newRgns, \%newRgn;
} }
return { return {
AppliedToDimensions => { W => $val[1], H => $val[2], Unit => 'pixel' }, AppliedToDimensions => { W => $val[1], H => $val[2], Unit => 'pixel' },
RegionList => \@newRgns, RegionList => \@newRgns,
}; };
}, },
}, },
# create an MWG RegionInfo structure from an IPTC ImageRegion list # create an MWG RegionInfo structure from an IPTC ImageRegion list
MyRegion2 => { IPTCRegion2MWGRegion => {
Name => 'MyRegion', Name => 'MPRegion2MWGRegion',
Require => { Require => {
0 => 'ImageRegion', 0 => 'ImageRegion',
1 => 'ImageWidth', 1 => 'ImageWidth',
2 => 'ImageHeight', 2 => 'ImageHeight',
}, },
ValueConv => q{ ValueConv => q{
my ($rgn, @newRgns); my ($rgn, @newRgns);
my $rgns = ref $val[0] eq 'ARRAY' ? $val[0] : [ $val[0] ]; my $rgns = ref $val[0] eq 'ARRAY' ? $val[0] : [ $val[0] ];
foreach $rgn (@$rgns) { foreach $rgn (@$rgns) {
my %newRgn = ( Type => 'Face' ); my %newRgn = ( Type => 'Face' );
skipping to change at line 111 skipping to change at line 113
push @newRgns, \%newRgn; push @newRgns, \%newRgn;
} }
return { return {
AppliedToDimensions => { W => $val[1], H => $val[2], Unit => 'pixel' }, AppliedToDimensions => { W => $val[1], H => $val[2], Unit => 'pixel' },
RegionList => \@newRgns, RegionList => \@newRgns,
}; };
}, },
}, },
# create a Microsoft RegionInfoMP structure from an MWG RegionInfo struc ture # create a Microsoft RegionInfoMP structure from an MWG RegionInfo struc ture
MyRegionMP => { MWGRegion2MPRegion => {
Require => 'RegionInfo', Require => 'RegionInfo',
ValueConv => q{ ValueConv => q{
my ($rgn, @newRgns); my ($rgn, @newRgns);
foreach $rgn (@{$val[0]{RegionList}}) { foreach $rgn (@{$val[0]{RegionList}}) {
next unless $$rgn{Area} or defined $$rgn{Name}; next unless $$rgn{Area} or defined $$rgn{Name};
my %newRgn; my %newRgn;
if ($$rgn{Area}) { if ($$rgn{Area}) {
my @rect = @{$$rgn{Area}}{'X','Y','W','H'}; my @rect = @{$$rgn{Area}}{'X','Y','W','H'};
$rect[0] -= $rect[2]/2; $rect[0] -= $rect[2]/2;
$rect[1] -= $rect[3]/2; $rect[1] -= $rect[3]/2;
$newRgn{Rectangle} = join(', ', @rect); $newRgn{Rectangle} = join(', ', @rect);
} }
$newRgn{PersonDisplayName} = $$rgn{Name} if defined $$rgn{Na me}; $newRgn{PersonDisplayName} = $$rgn{Name} if defined $$rgn{Na me};
push @newRgns, \%newRgn; push @newRgns, \%newRgn;
} }
return { Regions => \@newRgns }; return { Regions => \@newRgns };
}, },
}, },
# create a Microsoft RegionInfoMP structure from an IPTC ImageRegion lis t # create a Microsoft RegionInfoMP structure from an IPTC ImageRegion lis t
MyRegionMP2 => { IPTCRegion2MPRegion => {
Name => 'MyRegionMP', Name => 'MWGRegion2MPRegion',
Require => { Require => {
0 => 'ImageRegion', 0 => 'ImageRegion',
1 => 'ImageWidth', 1 => 'ImageWidth',
2 => 'ImageHeight', 2 => 'ImageHeight',
}, },
ValueConv => q{ ValueConv => q{
my ($rgn, @newRgns); my ($rgn, @newRgns);
my $rgns = ref $val[0] eq 'ARRAY' ? $val[0] : [ $val[0] ]; my $rgns = ref $val[0] eq 'ARRAY' ? $val[0] : [ $val[0] ];
foreach $rgn (@$rgns) { foreach $rgn (@$rgns) {
my %newRgn; my %newRgn;
skipping to change at line 162 skipping to change at line 164
next unless defined $$rgn{Name}; next unless defined $$rgn{Name};
} }
$newRgn{PersonDisplayName} = $$rgn{Name} if defined $$rgn{Na me}; $newRgn{PersonDisplayName} = $$rgn{Name} if defined $$rgn{Na me};
push @newRgns, \%newRgn; push @newRgns, \%newRgn;
} }
return { Regions => \@newRgns }; return { Regions => \@newRgns };
}, },
}, },
# create an IPTC ImageRegion list from an MWG RegionInfo structure # create an IPTC ImageRegion list from an MWG RegionInfo structure
MyRegionIPTC => { MWGRegion2IPTCRegion => {
Require => 'RegionInfo', Require => 'RegionInfo',
ValueConv => q{ ValueConv => q{
my ($rgn, @newRgns); my ($rgn, @newRgns);
foreach $rgn (@{$val[0]{RegionList}}) { foreach $rgn (@{$val[0]{RegionList}}) {
next unless $$rgn{Area} or defined $$rgn{Name}; next unless $$rgn{Area} or defined $$rgn{Name};
my %newRgn; my %newRgn;
if ($$rgn{Area}) { if ($$rgn{Area}) {
my @rect = @{$$rgn{Area}}{'X','Y','W','H'}; my @rect = @{$$rgn{Area}}{'X','Y','W','H'};
$rect[0] -= $rect[2]/2; $rect[0] -= $rect[2]/2;
$rect[1] -= $rect[3]/2; $rect[1] -= $rect[3]/2;
skipping to change at line 190 skipping to change at line 192
}; };
} }
$newRgn{Name} = $$rgn{Name} if defined $$rgn{Name}; $newRgn{Name} = $$rgn{Name} if defined $$rgn{Name};
push @newRgns, \%newRgn; push @newRgns, \%newRgn;
} }
return \@newRgns; return \@newRgns;
}, },
}, },
# create an IPTC ImageRegion list from a Microsoft RegionInfoMP structur e # create an IPTC ImageRegion list from a Microsoft RegionInfoMP structur e
MyRegionIPTC2 => { MPRegion2IPTCRegion => {
Name => 'MyRegionIPTC', Name => 'MWGRegion2IPTCRegion',
Require => 'RegionInfoMP', Require => 'RegionInfoMP',
ValueConv => q{ ValueConv => q{
my ($rgn, @newRgns); my ($rgn, @newRgns);
foreach $rgn (@{$val[0]{Regions}}) { foreach $rgn (@{$val[0]{Regions}}) {
my $name = $$rgn{PersonDisplayName}; my $name = $$rgn{PersonDisplayName};
next unless $$rgn{Rectangle} or defined $name; next unless $$rgn{Rectangle} or defined $name;
my %newRgn; my %newRgn;
if (defined $name) { if (defined $name) {
# don't add ignored faces # don't add ignored faces
next if $name eq 'ffffffffffffffff'; next if $name eq 'ffffffffffffffff';
skipping to change at line 223 skipping to change at line 225
} if @rect == 4; } if @rect == 4;
} }
push @newRgns, \%newRgn; push @newRgns, \%newRgn;
} }
return \@newRgns; return \@newRgns;
}, },
}, },
}, },
); );
%Image::ExifTool::UserDefined::Shortcuts = (
MyRegion => 'MPRegion2MWGRegion',
MyRegion2 => 'IPTCRegion2MWGRegion',
MyRegionMP => 'MWGRegion2MPRegion',
MyRegionMP2 => 'IPTCRegion2MPRegion',
MyRegionIPTC => 'MWGRegion2IPTCRegion',
MyRegionIPTC2 => 'MPRegion2IPTCRegion',
);
1; #end 1; #end
 End of changes. 11 change blocks. 
12 lines changed or deleted 23 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)