exiftool-vendored.pl 12.78.0 → 12.82.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. package/bin/Changes +80 -3
  2. package/bin/MANIFEST +29 -2
  3. package/bin/META.json +1 -1
  4. package/bin/META.yml +1 -1
  5. package/bin/README +3 -2
  6. package/bin/config_files/acdsee.config +37 -57
  7. package/bin/config_files/example.config +6 -0
  8. package/bin/exiftool +67 -25
  9. package/bin/lib/Image/ExifTool/BuildTagLookup.pm +44 -31
  10. package/bin/lib/Image/ExifTool/CanonVRD.pm +2 -2
  11. package/bin/lib/Image/ExifTool/FujiFilm.pm +21 -5
  12. package/bin/lib/Image/ExifTool/GM.pm +543 -0
  13. package/bin/lib/Image/ExifTool/GeoLang/cs.pm +978 -0
  14. package/bin/lib/Image/ExifTool/GeoLang/de.pm +1975 -0
  15. package/bin/lib/Image/ExifTool/GeoLang/en_ca.pm +44 -0
  16. package/bin/lib/Image/ExifTool/GeoLang/en_gb.pm +124 -0
  17. package/bin/lib/Image/ExifTool/GeoLang/es.pm +2921 -0
  18. package/bin/lib/Image/ExifTool/GeoLang/fi.pm +1116 -0
  19. package/bin/lib/Image/ExifTool/GeoLang/fr.pm +3171 -0
  20. package/bin/lib/Image/ExifTool/GeoLang/it.pm +2750 -0
  21. package/bin/lib/Image/ExifTool/GeoLang/ja.pm +10256 -0
  22. package/bin/lib/Image/ExifTool/GeoLang/ko.pm +4499 -0
  23. package/bin/lib/Image/ExifTool/GeoLang/nl.pm +1270 -0
  24. package/bin/lib/Image/ExifTool/GeoLang/pl.pm +3019 -0
  25. package/bin/lib/Image/ExifTool/GeoLang/ru.pm +18220 -0
  26. package/bin/lib/Image/ExifTool/GeoLang/sk.pm +441 -0
  27. package/bin/lib/Image/ExifTool/GeoLang/sv.pm +714 -0
  28. package/bin/lib/Image/ExifTool/GeoLang/tr.pm +452 -0
  29. package/bin/lib/Image/ExifTool/GeoLang/zh_cn.pm +2225 -0
  30. package/bin/lib/Image/ExifTool/GeoLang/zh_tw.pm +72 -0
  31. package/bin/lib/Image/ExifTool/Geolocation.dat +0 -0
  32. package/bin/lib/Image/ExifTool/Geolocation.pm +867 -146
  33. package/bin/lib/Image/ExifTool/Geotag.pm +13 -1
  34. package/bin/lib/Image/ExifTool/JSON.pm +7 -2
  35. package/bin/lib/Image/ExifTool/M2TS.pm +32 -4
  36. package/bin/lib/Image/ExifTool/MakerNotes.pm +2 -2
  37. package/bin/lib/Image/ExifTool/Microsoft.pm +1 -1
  38. package/bin/lib/Image/ExifTool/Nikon.pm +331 -22
  39. package/bin/lib/Image/ExifTool/NikonCustom.pm +55 -1
  40. package/bin/lib/Image/ExifTool/Olympus.pm +1 -0
  41. package/bin/lib/Image/ExifTool/OpenEXR.pm +37 -19
  42. package/bin/lib/Image/ExifTool/PNG.pm +3 -3
  43. package/bin/lib/Image/ExifTool/QuickTime.pm +40 -24
  44. package/bin/lib/Image/ExifTool/QuickTimeStream.pl +61 -30
  45. package/bin/lib/Image/ExifTool/README +8 -5
  46. package/bin/lib/Image/ExifTool/Sony.pm +1 -1
  47. package/bin/lib/Image/ExifTool/TagLookup.pm +4820 -4750
  48. package/bin/lib/Image/ExifTool/TagNames.pod +1000 -615
  49. package/bin/lib/Image/ExifTool/WriteQuickTime.pl +31 -8
  50. package/bin/lib/Image/ExifTool/WriteXMP.pl +1 -1
  51. package/bin/lib/Image/ExifTool/Writer.pl +58 -2
  52. package/bin/lib/Image/ExifTool/XMP.pm +20 -3
  53. package/bin/lib/Image/ExifTool/XMP2.pl +64 -0
  54. package/bin/lib/Image/ExifTool.pm +210 -97
  55. package/bin/lib/Image/ExifTool.pod +44 -18
  56. package/bin/perl-Image-ExifTool.spec +1 -1
  57. package/bin/pp_build_exe.args +4 -4
  58. package/package.json +3 -3
@@ -29,7 +29,7 @@ use vars qw($VERSION $RELEASE @ISA @EXPORT_OK %EXPORT_TAGS $AUTOLOAD @fileTypes
29
29
  %jpegMarker %specialTags %fileTypeLookup $testLen $exeDir
30
30
  %static_vars);
31
31
 
32
- $VERSION = '12.78';
32
+ $VERSION = '12.82';
33
33
  $RELEASE = '';
34
34
  @ISA = qw(Exporter);
35
35
  %EXPORT_TAGS = (
@@ -103,6 +103,7 @@ sub VerboseValue($$$;$);
103
103
  sub VPrint($$@);
104
104
  sub Rationalize($;$);
105
105
  sub Write($@);
106
+ sub GetGeolocateTags($$;$);
106
107
  sub WriteTrailerBuffer($$$);
107
108
  sub AddNewTrailers($;@);
108
109
  sub Tell($);
@@ -920,7 +921,7 @@ $testLen = 1024; # number of bytes to read when testing for magic number
920
921
  DICOM=> '(.{128}DICM|\0[\x02\x04\x06\x08]\0[\0-\x20]|[\x02\x04\x06\x08]\0[\0-\x20]\0)',
921
922
  DOCX => 'PK\x03\x04',
922
923
  DPX => '(SDPX|XPDS)',
923
- DR4 => 'IIII\x04\0\x04\0',
924
+ DR4 => 'IIII[\x04|\x05]\0\x04\0',
924
925
  DSS => '(\x02dss|\x03ds2)',
925
926
  DV => '\x1f\x07\0[\x3f\xbf]', # (not tested if extension recognized)
926
927
  DWF => '\(DWF V\d',
@@ -1102,6 +1103,8 @@ my @availableOptions = (
1102
1103
  [ 'FilterW', undef, 'input filter when writing tag values' ],
1103
1104
  [ 'FixBase', undef, 'fix maker notes base offsets' ],
1104
1105
  [ 'Geolocation', undef, 'generate geolocation tags' ],
1106
+ [ 'GeolocAltNames', 1, 'search alternate city names if available' ],
1107
+ [ 'GeolocFeature', undef, 'regular expression of geolocation features to match' ],
1105
1108
  [ 'GeolocMinPop', undef, 'minimum geolocation population' ],
1106
1109
  [ 'GeolocMaxDist', undef, 'maximum geolocation distance' ],
1107
1110
  [ 'GeoMaxIntSecs', 1800, 'geotag maximum interpolation time (secs)' ],
@@ -1134,6 +1137,7 @@ my @availableOptions = (
1134
1137
  [ 'NoPDFList', undef, 'flag to avoid splitting PDF List-type tag values' ],
1135
1138
  [ 'NoWarning', undef, 'regular expression for warnings to suppress' ],
1136
1139
  [ 'Password', undef, 'password for password-protected PDF documents' ],
1140
+ [ 'PrintCSV', undef, 'flag to print CSV directly (selected metadata types only)' ],
1137
1141
  [ 'PrintConv', 1, 'flag to enable print conversion' ],
1138
1142
  [ 'QuickTimeHandler', 1, 'flag to add mdir Handler to newly created Meta box' ],
1139
1143
  [ 'QuickTimePad', undef, 'flag to preserve padding of QuickTime CR3 tags' ],
@@ -1171,7 +1175,7 @@ my @defaultWriteGroups = qw(
1171
1175
 
1172
1176
  # group hash for ExifTool-generated tags
1173
1177
  my %allGroupsExifTool = ( 0 => 'ExifTool', 1 => 'ExifTool', 2 => 'ExifTool' );
1174
- my %geoGroups = ( Groups => { 0 => 'ExifTool', 1 => 'ExifTool', 2 => 'Location' } );
1178
+ my %geoInfo = ( Groups => { 0 => 'ExifTool', 1 => 'ExifTool', 2 => 'Location' }, Priority => 0 );
1175
1179
 
1176
1180
  # special tag names (not used for tag info)
1177
1181
  %specialTags = map { $_ => 1 } qw(
@@ -1201,7 +1205,7 @@ sub DummyWriteProc { return 1; }
1201
1205
 
1202
1206
  my %systemTagsNotes = (
1203
1207
  Notes => q{
1204
- extracted only if specifically requested or the L<SystemTags|../ExifTool.html#SystemTags> or L<RequestAll|../ExifTool.html#RequestAll> API
1208
+ extracted only if specifically requested or the API L<SystemTags|../ExifTool.html#SystemTags> or L<RequestAll|../ExifTool.html#RequestAll>
1205
1209
  option is set
1206
1210
  },
1207
1211
  );
@@ -1484,7 +1488,7 @@ my %systemTagsNotes = (
1484
1488
  FileAttributes => {
1485
1489
  Groups => { 1 => 'System', 2 => 'Other' },
1486
1490
  Notes => q{
1487
- extracted only if specifically requested or the L<SystemTags|../ExifTool.html#SystemTags> or L<RequestAll|../ExifTool.html#RequestAll> API
1491
+ extracted only if specifically requested or the API L<SystemTags|../ExifTool.html#SystemTags> or L<RequestAll|../ExifTool.html#RequestAll>
1488
1492
  option is set. 2 or 3 values: 0. File type, 1. Attribute bits, 2. Windows
1489
1493
  attribute bits if Win32API::File is available
1490
1494
  },
@@ -1539,7 +1543,7 @@ my %systemTagsNotes = (
1539
1543
  FileUserID => {
1540
1544
  Groups => { 1 => 'System', 2 => 'Other' },
1541
1545
  Notes => q{
1542
- extracted only if specifically requested or the L<SystemTags|../ExifTool.html#SystemTags> or L<RequestAll|../ExifTool.html#RequestAll> API
1546
+ extracted only if specifically requested or the API L<SystemTags|../ExifTool.html#SystemTags> or L<RequestAll|../ExifTool.html#RequestAll>
1543
1547
  option is set. Returns user ID number with the -n option, or name
1544
1548
  otherwise. May be written with either user name or number
1545
1549
  },
@@ -1553,7 +1557,7 @@ my %systemTagsNotes = (
1553
1557
  FileGroupID => {
1554
1558
  Groups => { 1 => 'System', 2 => 'Other' },
1555
1559
  Notes => q{
1556
- extracted only if specifically requested or the L<SystemTags|../ExifTool.html#SystemTags> or L<RequestAll|../ExifTool.html#RequestAll> API
1560
+ extracted only if specifically requested or the API L<SystemTags|../ExifTool.html#SystemTags> or L<RequestAll|../ExifTool.html#RequestAll>
1557
1561
  option is set. Returns group ID number with the -n option, or name
1558
1562
  otherwise. May be written with either group name or number
1559
1563
  },
@@ -1689,7 +1693,7 @@ my %systemTagsNotes = (
1689
1693
  Flags => ['Writable' ,'Protected', 'Binary'],
1690
1694
  Permanent => 0, # (this is 1 by default for MakerNotes tags)
1691
1695
  WriteCheck => q{
1692
- return undef if $val =~ /^IIII\x04\0\x04\0/;
1696
+ return undef if $val =~ /^IIII[\x04|\x05]\0\x04\0/;
1693
1697
  return 'Invalid CanonDR4 data';
1694
1698
  },
1695
1699
  },
@@ -1796,7 +1800,7 @@ my %systemTagsNotes = (
1796
1800
  Groups => { 0 => 'ExifTool', 1 => 'ExifTool', 2 => 'Other' },
1797
1801
  Notes => q{
1798
1802
  the clock time in seconds taken by ExifTool to extract information from this
1799
- file. Not generated unless specifically requested or the L<RequestAll|../ExifTool.html#RequestAll> API
1803
+ file. Not generated unless specifically requested or the API L<RequestAll|../ExifTool.html#RequestAll>
1800
1804
  option is set. Requires Time::HiRes
1801
1805
  },
1802
1806
  PrintConv => 'sprintf("%.3g s", $val)',
@@ -1937,7 +1941,7 @@ my %systemTagsNotes = (
1937
1941
  Groups => { 0 => 'Trailer' },
1938
1942
  Notes => q{
1939
1943
  the full JPEG trailer data block. Extracted only if specifically requested
1940
- or the API RequestAll option is set to 3 or higher
1944
+ or the API L<RequestAll|../ExifTool.html#RequestAll> option is set to 3 or higher
1941
1945
  },
1942
1946
  Writable => 1,
1943
1947
  Protected => 1,
@@ -1970,78 +1974,88 @@ my %systemTagsNotes = (
1970
1974
  Writable => 1,
1971
1975
  WriteOnly => 1,
1972
1976
  WriteNothing => 1,
1973
- AllowGroup => '(xmp|iptc)',
1977
+ AllowGroup => '(exif|gps|xmp|xmp-exif|xmp-iptcext|xmp-iptccore|xmp-photoshop|iptc|quicktime|itemlist|keys|userdata)',
1974
1978
  Notes => q{
1975
- this write-only tag accepts GPS coordinates in the same form as GPSPosition
1976
- and by default writes XMP City, State, CountryCode and Country, but the IPTC
1977
- group may be specified to instead write IPTC City, Province-State,
1978
- Country-PrimaryLocationCode and Country-PrimaryLocationName. Writable
1979
- regardless of the API Geolocation option setting
1979
+ this write-only tag may be used to write geolocation city, region, country
1980
+ code and country based in input GPS coordinates, or to write GPS
1981
+ coordinates based on geolocation name. See the
1982
+ L<Writing section of the Geolocation page|../geolocation.html#Write> for
1983
+ details. This tag is writable regardless of the API L<Geolocation|../ExifTool.html#Geolocation>
1984
+ option setting
1980
1985
  },
1981
1986
  DelCheck => q{
1982
- my $grp = lc($wantGroup || 'xmp');
1983
- if ($grp eq 'xmp') {
1984
- $self->SetNewValue('XMP:'.$_) foreach qw(City State CountryCode Country);
1985
- } elsif ($grp eq 'iptc') {
1986
- $self->SetNewValue('IPTC:'.$_) foreach qw(City Province-State Country-PrimaryLocationCode Country-PrimaryLocationName);
1987
- }
1987
+ my @tags = $self->GetGeolocateTags($wantGroup);
1988
+ $self->SetNewValue($_) foreach @tags;
1988
1989
  return '';
1989
1990
  },
1990
1991
  ValueConvInv => q{
1991
- my ($lat, $lon) = split /[, ]+/, $val;
1992
- defined $lat and defined $lon or warn('Invalid GPS position, use "Lat, Lon"'), return undef;
1993
- my $grp = lc($wantGroup || 'xmp');
1994
- if ($grp ne 'xmp' and $grp ne 'iptc') {
1995
- warn "Invalid group name for Geolocate\n";
1996
- } else {
1997
- require Image::ExifTool::Geolocation;
1998
- my @a = Image::ExifTool::Geolocation::Geolocate($lat, $lon,
1999
- $$self{OPTIONS}{GeolocMinPop}, $$self{OPTIONS}{GeolocMaxDist});
2000
- my $i = 0;
2001
- if (not defined $a[0]) {
2002
- warn "No suitable geolocation found\n";
2003
- } elsif ($grp eq 'xmp') {
2004
- foreach (qw(City State CountryCode Country)) {
2005
- next unless defined $a[$i++];
2006
- $self->SetNewValue('XMP:'.$_, $self->Decode($a[$i-1],'UTF8'));
2007
- }
1992
+ require Image::ExifTool::Geolocation;
1993
+ # write this tag later if geotagging
1994
+ return $val if $val =~ /\bgeotag\b/i;
1995
+ $val .= ',both';
1996
+ my $opts = $$self{OPTIONS};
1997
+ my ($n, $i, $km, $be) = Image::ExifTool::Geolocation::Geolocate($self->Encode($val,'UTF8'), $opts);
1998
+ return '' unless $n;
1999
+ if ($n > 1 and $self->Warn('Multiple matching cities found',2)) {
2000
+ warn "$$self{VALUE}{Warning}\n";
2001
+ return '';
2002
+ }
2003
+ my @geo = Image::ExifTool::Geolocation::GetEntry($i, $$opts{Lang});
2004
+ my @tags = $self->GetGeolocateTags($wantGroup, $km ? 0 : 1);
2005
+ my %geoNum = ( City => 0, Province => 1, State => 1, Code => 3, Country => 4,
2006
+ Coordinates => 89, Latitude => 8, Longitude => 9 );
2007
+ my ($tag, $value);
2008
+ foreach $tag (@tags) {
2009
+ if ($tag =~ /GPS(Coordinates|Latitude|Longitude)?/) {
2010
+ $value = $geoNum{$1} == 89 ? "$geo[8],$geo[9]" : $geo[$geoNum{$1}];
2011
+ } elsif ($tag =~ /(Code)/ or $tag =~ /(City|Province|State|Country)/) {
2012
+ $value = $geo[$geoNum{$1}];
2013
+ next unless defined $value;
2014
+ $value = $self->Decode($value,'UTF8');
2015
+ $value .= ' ' if $tag eq 'iptc:Country-PrimaryLocationCode'; # (IPTC requires 3-char code)
2016
+ } elsif ($tag =~ /LocationName/) {
2017
+ $value = $geo[0] or next;
2018
+ $value .= ', ' . $geo[1] if $geo[1];
2019
+ $value .= ', ' . $geo[4] if $geo[4];
2020
+ $value = $self->Decode($value, 'UTF8');
2008
2021
  } else {
2009
- $a[2] .= ' '; # pad country code with space to meet IPTC length requirements
2010
- foreach (qw(City Province-State Country-PrimaryLocationCode Country-PrimaryLocationName)) {
2011
- next unless defined $a[$i++];
2012
- $self->SetNewValue('IPTC:'.$_, $self->Decode($a[$i-1],'UTF8'));
2013
- }
2022
+ next; # (shouldn't happen)
2014
2023
  }
2024
+ $self->SetNewValue($tag => $value, Type => 'PrintConv');
2015
2025
  }
2016
2026
  return '';
2017
2027
  },
2018
2028
  PrintConvInv => q{
2019
- return undef unless $val =~ /(.*? ?[NS]?), ?(.*? ?[EW]?)$/ or
2020
- $val =~ /^\s*(-?\d+(?:\.\d+)?)\s*(-?\d+(?:\.\d+)?)\s*$/;
2021
- my ($lat, $lon) = ($1, $2);
2022
- require Image::ExifTool::GPS;
2023
- $lat = Image::ExifTool::GPS::ToDegrees($lat, 1, "lat");
2024
- $lon = Image::ExifTool::GPS::ToDegrees($lon, 1, "lon");
2025
- return "$lat $lon";
2029
+ my @args = split /\s*,\s*/, $val;
2030
+ my $lat = 1;
2031
+ foreach (@args) {
2032
+ next unless /^[-+]?\d/;
2033
+ require Image::ExifTool::GPS;
2034
+ $_ = Image::ExifTool::GPS::ToDegrees($_, 1, $lat ? 'lat' : 'lon');
2035
+ $lat ^= 1;
2036
+ }
2037
+ return join(',', @args);
2026
2038
  },
2027
- },
2028
- GeolocationCity => {
2029
- %geoGroups,
2039
+ },
2040
+ GeolocationBearing => { %geoInfo,
2030
2041
  Notes => q{
2031
- name of city nearest to the current GPS coordinates. Geolocation tags are
2032
- generated only if API Geolocation option is set
2042
+ compass bearing to GeolocationCity center. Geolocation tags are
2043
+ generated only if API L<Geolocation|../ExifTool.html#Geolocation> option is set
2033
2044
  },
2034
2045
  },
2035
- GeolocationRegion => { %geoGroups, Notes => 'geolocation state, province or region' },
2036
- GeolocationCountry => { %geoGroups, Notes => 'geolocation country name' },
2037
- GeolocationCountryCode=>{%geoGroups, Notes => 'geolocation country code' },
2038
- GeolocationTimeZone => { %geoGroups, Notes => 'geolocation time zone name' },
2039
- GeolocationPopulation=>{ %geoGroups, Notes => 'city population rounded to 1 significant digit' },
2040
- GeolocationDistance => { %geoGroups, Notes => 'distance in km from current GPS to city', PrintConv => '"$val km"' },
2041
- GeolocationBearing => { %geoGroups, Notes => 'compass bearing to city center' },
2042
- GeolocationPosition => { %geoGroups, Notes => 'approximate GPS coordinates of city',
2046
+ GeolocationCity => { %geoInfo, Notes => 'name of city nearest to the current GPS coordinates', ValueConv => '$self->Decode($val,"UTF8")' },
2047
+ GeolocationRegion => { %geoInfo, Notes => 'geolocation state, province or region', ValueConv => '$self->Decode($val,"UTF8")' },
2048
+ GeolocationSubregion=> { %geoInfo, Notes => 'geolocation county or subregion', ValueConv => '$self->Decode($val,"UTF8")' },
2049
+ GeolocationCountry => { %geoInfo, Notes => 'geolocation country name', ValueConv => '$self->Decode($val,"UTF8")' },
2050
+ GeolocationCountryCode=>{%geoInfo, Notes => 'geolocation country code' },
2051
+ GeolocationTimeZone => { %geoInfo, Notes => 'geolocation time zone name' },
2052
+ GeolocationFeatureCode=>{%geoInfo, Notes => 'feature code, see L<http://www.geonames.org/export/codes.html#P>' },
2053
+ GeolocationPopulation=>{ %geoInfo, Notes => 'city population rounded to 2 significant digits' },
2054
+ GeolocationDistance => { %geoInfo, Notes => 'distance in km from current GPS to city', PrintConv => '"$val km"' },
2055
+ GeolocationPosition => { %geoInfo, Notes => 'approximate GPS coordinates of city',
2043
2056
  PrintConv => '$val =~ s/ /, /; $val',
2044
2057
  },
2058
+ GeolocationWarning => { %geoInfo },
2045
2059
  );
2046
2060
 
2047
2061
  # tags defined by UserParam option (added at runtime)
@@ -2637,7 +2651,6 @@ sub ExtractInfo($;@)
2637
2651
  $self->Options(Duplicates => 1) if $$options{HtmlDump};
2638
2652
  # enable Validate option if Validate tag is requested
2639
2653
  $self->Options(Validate => 1) if $$req{validate};
2640
-
2641
2654
  if (defined $_[0]) {
2642
2655
  # only initialize filename if called with arguments
2643
2656
  $$self{FILENAME} = undef; # name of file (or '' if we didn't open it)
@@ -2646,8 +2659,14 @@ sub ExtractInfo($;@)
2646
2659
  $self->ParseArguments(@_); # initialize from our arguments
2647
2660
  }
2648
2661
  }
2662
+ # ignore all tags and set ExtractEmbedded if outputting CSV directly
2663
+ if ($self->Options('PrintCSV')) {
2664
+ $$self{OPTIONS}{IgnoreTags} = { all => 1 };
2665
+ $self->Options(ExtractEmbedded => 1);
2666
+ }
2649
2667
  # initialize ExifTool object members
2650
2668
  $self->Init();
2669
+ $$self{InExtract} = 1; # set flag indicating we are inside ExtractInfo
2651
2670
 
2652
2671
  delete $$self{MAKER_NOTE_FIXUP}; # fixup information for extracted maker notes
2653
2672
  delete $$self{MAKER_NOTE_BYTE_ORDER};
@@ -2825,6 +2844,8 @@ sub ExtractInfo($;@)
2825
2844
  $self->FoundTag('FileTypeExtension', '');
2826
2845
  $self->DoneExtract();
2827
2846
  $raf->Close() if $raf;
2847
+ %saveOptions and $$self{OPTIONS} = \%saveOptions;
2848
+ delete $$self{InExtract} unless $reEntry;
2828
2849
  return 1;
2829
2850
  }
2830
2851
  # get list of file types to check
@@ -3055,6 +3076,13 @@ sub ExtractInfo($;@)
3055
3076
  # restore necessary members when exiting re-entrant code
3056
3077
  $$self{$_} = $$reEntry{$_} foreach keys %$reEntry;
3057
3078
  SetByteOrder($saveOrder);
3079
+ } else {
3080
+ # call cleanup routines if necessary
3081
+ if ($$self{Cleanup}) {
3082
+ &$_($self) foreach @{$$self{Cleanup}};
3083
+ delete $$self{Cleanup};
3084
+ }
3085
+ delete $$self{InExtract};
3058
3086
  }
3059
3087
 
3060
3088
  # ($type may be undef without an Error when processing sub-documents)
@@ -3075,8 +3103,13 @@ sub GetInfo($;@)
3075
3103
  {
3076
3104
  local $_;
3077
3105
  my $self = shift;
3078
- my %saveOptions;
3106
+ my (%saveOptions, @saveMembers, @savedMembers);
3079
3107
 
3108
+ # save necessary members to allow GetInfo to be called from within ExtractInfo
3109
+ if ($$self{InExtract}) {
3110
+ @saveMembers = qw(REQUESTED_TAGS REQ_TAG_LOOKUP IO_TAG_LIST);
3111
+ @savedMembers = @$self{@saveMembers};
3112
+ }
3080
3113
  unless (@_ and not defined $_[0]) {
3081
3114
  %saveOptions = %{$$self{OPTIONS}}; # save original options
3082
3115
  # must set FILENAME so it isn't parsed from the arguments
@@ -3159,8 +3192,9 @@ sub GetInfo($;@)
3159
3192
  @{$$self{IO_TAG_LIST}} = $self->GetTagList($rtnTags, $sort, $$self{OPTIONS}{Sort2});
3160
3193
  }
3161
3194
 
3162
- # restore original options
3195
+ # restore original options and member variables
3163
3196
  %saveOptions and $$self{OPTIONS} = \%saveOptions;
3197
+ @$self{@saveMembers} = @savedMembers if @saveMembers;
3164
3198
 
3165
3199
  return \%info;
3166
3200
  }
@@ -4253,36 +4287,103 @@ sub DoneExtract($)
4253
4287
  Image::ExifTool::Validate::FinishValidate($self, $$self{REQ_TAG_LOOKUP}{validate});
4254
4288
  }
4255
4289
  # generate geolocation tags if requested
4256
- if ($$opts{Geolocation} and ((defined $$self{VALUE}{GPSLatitude} and
4257
- defined $$self{VALUE}{GPSLongitude}) or $$self{VALUE}{GPSCoordinates} or
4258
- $$opts{Geolocation} =~ /,/))
4259
- {
4260
- my $lat = $self->GetValue('GPSLatitude', 'ValueConv');
4261
- my $lon = $self->GetValue('GPSLongitude', 'ValueConv');
4262
- if (defined $lat and defined $lon) {
4263
- my $latRef = $$self{VALUE}{GPSLatitudeRef};
4264
- my $lonRef = $$self{VALUE}{GPSLongitudeRef};
4265
- $lat = -$lat if $lat and $lat > 0 and $latRef and $latRef eq 'S';
4266
- $lon = -$lon if $lon and $lon > 0 and $lonRef and $lonRef eq 'W';
4267
- } elsif ($$self{VALUE}{GPSCoordinates}) {
4268
- my $pos = $self->GetValue('GPSCoordinates', 'ValueConv');
4269
- ($lat, $lon) = split /[, ]+/, $pos;
4270
- } else {
4271
- ($lat, $lon) = split /[, ]+/, $$opts{Geolocation};
4272
- }
4273
- if (defined $lat and defined $lon) {
4290
+ if ($$opts{Geolocation}) {
4291
+ my ($arg, @defaults, @tags, $tag, @coord, @ref, @city, $doneCity, $both);
4292
+ my $geoOpt = $$opts{Geolocation};
4293
+ my @args = split /\s*,\s*/, $$opts{Geolocation};
4294
+ foreach $arg (@args) {
4295
+ lc $arg eq 'both' and $both = 1, next;
4296
+ $arg !~ s/^\$// and push(@defaults, $arg), next;
4297
+ push @tags, $arg; # argument is a tag name
4298
+ }
4299
+ unless (@tags) {
4300
+ # default tags to read if not specified
4301
+ @tags = qw(GPSLatitude GPSLongitude GPSLatitudeRef GPSLongitudeRef
4302
+ GPSCoordinates LocationShownGPSLatitude LocationShownGPSLongitude
4303
+ XMP:City State CountryCode Country
4304
+ IPTC:City Province-State Country-PrimaryLocationCode Country-PrimaryLocationName
4305
+ LocationShownCity LocationShownProvinceState LocationShownCountryCode LocationShownCountryName);
4306
+ }
4307
+ # get information for specified tags
4308
+ my $info = $self->GetInfo(\@tags, { PrintConv => 0, Duplicates => 0 }); # (returns tags in proper case)
4309
+ $opts = $$self{OPTIONS}; # (necessary because GetInfo changes the OPTIONS hash)
4310
+ foreach $tag (@tags) {
4311
+ my $val = $$info{$tag};
4312
+ next unless defined $val;
4313
+ $self->VPrint(0, "Found $tag ($val)\n");
4314
+ if ($tag =~ /Coordinates/) {
4315
+ next if defined $coord[0] and defined $coord[1];
4316
+ @coord = split ' ', $val;
4317
+ next;
4318
+ }
4319
+ my $n = $tag =~ /Latitude/ ? 0 : ($tag =~ /Longitude/ ? 1 : undef);
4320
+ if (defined $n) {
4321
+ if ($tag =~ /Ref$/) {
4322
+ $ref[$n] = $val unless $ref[$n];
4323
+ } else {
4324
+ $coord[$n] = $val unless defined $coord[$n];
4325
+ }
4326
+ next;
4327
+ }
4328
+ # handle city tags (save info for first city found)
4329
+ if ($tag =~ /City/) {
4330
+ @city and $doneCity = 1, next;
4331
+ push @city, $val;
4332
+ } elsif (@city) {
4333
+ push @city, $val unless $doneCity;
4334
+ next if $doneCity;
4335
+ }
4336
+ }
4337
+ if (defined $coord[0] and defined $coord[1]) {
4338
+ $coord[0] = -$coord[0] if $ref[0] and $coord[0] > 0 and $ref[0] eq 'S';
4339
+ $coord[1] = -$coord[1] if $ref[1] and $coord[1] > 0 and $ref[1] eq 'W';
4340
+ $arg = join ',', @coord;
4341
+ } elsif (@city) {
4342
+ $arg = join ',', @city;
4343
+ }
4344
+ if (not defined $arg) {
4345
+ # use specified default values if no tags found
4346
+ $arg = join ',', @defaults;
4347
+ undef $arg if $arg eq '1';
4348
+ $both = 1; # use 'both' GPS and place names if provided
4349
+ }
4350
+ if ($arg) {
4351
+ $arg .= ',both' if $both;
4352
+ $arg = $self->Encode($arg, 'UTF8');
4274
4353
  require Image::ExifTool::Geolocation;
4275
- my @geo = Image::ExifTool::Geolocation::Geolocate($lat, $lon, $$opts{GeolocMinPop}, $$opts{GeolocMaxDist});
4276
- if ($geo[0]) {
4277
- $self->FoundTag(GeolocationCity => $self->Decode($geo[0],'UTF8'));
4278
- $self->FoundTag(GeolocationRegion => $self->Decode($geo[1],'UTF8')) if $geo[1];
4279
- $self->FoundTag(GeolocationCountryCode => $geo[2]);
4280
- $self->FoundTag(GeolocationCountry => $geo[3]) if $geo[3];
4281
- $self->FoundTag(GeolocationTimeZone => $geo[4]) if $geo[4];
4282
- $self->FoundTag(GeolocationPopulation => $geo[5]);
4283
- $self->FoundTag(GeolocationDistance => $geo[6]);
4284
- $self->FoundTag(GeolocationBearing => $geo[7]) if defined $geo[7];
4285
- $self->FoundTag(GeolocationPosition => "$geo[8] $geo[9]");
4354
+ if ($$opts{Verbose}) {
4355
+ if ($Image::ExifTool::Geolocation::dbInfo) {
4356
+ print "Loaded $Image::ExifTool::Geolocation::dbInfo\n";
4357
+ } else {
4358
+ print "Error loading Geolocation.dat\n";
4359
+ }
4360
+ }
4361
+ local $SIG{'__WARN__'} = \&SetWarning;
4362
+ undef $evalWarning;
4363
+ $$opts{GeolocMulti} = $$opts{Duplicates};
4364
+ my ($n, $i, $km, $be) = Image::ExifTool::Geolocation::Geolocate($arg, $opts);
4365
+ delete $$opts{GeolocMulti};
4366
+ # ($i will be an ARRAY ref if multiple matches were found and the Duplicates option is set)
4367
+ if ($n and (ref $i or $n < 2 or not $self->Warn('Multiple Geolocation cities are possible',2))) {
4368
+ my $list = ref $i ? $i : [ $i ]; # make a list if not done alreaday
4369
+ foreach $i (@$list) {
4370
+ my @geo = Image::ExifTool::Geolocation::GetEntry($i, $$opts{Lang});
4371
+ $self->FoundTag(GeolocationCity => $geo[0]);
4372
+ $self->FoundTag(GeolocationRegion => $geo[1]) if $geo[1];
4373
+ $self->FoundTag(GeolocationSubregion => $geo[2]) if $geo[2];
4374
+ $self->FoundTag(GeolocationCountryCode => $geo[3]);
4375
+ $self->FoundTag(GeolocationCountry => $geo[4]) if $geo[4];
4376
+ $self->FoundTag(GeolocationTimeZone => $geo[5]) if $geo[5];
4377
+ $self->FoundTag(GeolocationFeatureCode => $geo[6]);
4378
+ $self->FoundTag(GeolocationPopulation => $geo[7]);
4379
+ $self->FoundTag(GeolocationPosition => "$geo[8] $geo[9]");
4380
+ next if $i != $$list[0];
4381
+ $self->FoundTag(GeolocationDistance => $km) if defined $km;
4382
+ $self->FoundTag(GeolocationBearing => $be) if defined $be;
4383
+ $self->FoundTag(GeolocationWarning => "Search matched $n cities") if $n > 1;
4384
+ }
4385
+ } elsif ($evalWarning) {
4386
+ $self->Warn(CleanWarning());
4286
4387
  }
4287
4388
  }
4288
4389
  }
@@ -4963,6 +5064,7 @@ sub SetFoundTags($)
4963
5064
  $allTag = 1;
4964
5065
  } elsif ($tag =~ /[*?]/) {
4965
5066
  # allow wildcards in tag names
5067
+ $tag =~ tr/-_A-Za-z0-9*?//dc; # sterilize
4966
5068
  $tag =~ s/\*/[-\\w]*/g;
4967
5069
  $tag =~ s/\?/[-\\w]/g;
4968
5070
  $tag .= '( \\(.*)?' if $doDups or $allGrp;
@@ -4970,6 +5072,7 @@ sub SetFoundTags($)
4970
5072
  next unless @matches; # don't want entry in list for wildcard tags
4971
5073
  $allTag = 1;
4972
5074
  } elsif ($doDups or defined $group) {
5075
+ $tag =~ tr/-_A-Za-z0-9//dc; # sterilize
4973
5076
  # must also look for tags like "Tag (1)"
4974
5077
  # (but be sure not to match temporary ValueConv entries like "Tag #")
4975
5078
  @matches = grep(/^$tag( \(|$)/i, keys %$tagHash);
@@ -5182,6 +5285,16 @@ sub AUTOLOAD
5182
5285
  return DoAutoLoad($AUTOLOAD, @_);
5183
5286
  }
5184
5287
 
5288
+ #------------------------------------------------------------------------------
5289
+ # Add cleanup routine to call before returning from Extract
5290
+ # Inputs: 0) ExifTool ref, 1) code ref to routine with ExifTool ref as an argument
5291
+ sub AddCleanup($)
5292
+ {
5293
+ my ($self, $sub) = @_;
5294
+ $$self{Cleanup} or $$self{Cleanup} = [ ];
5295
+ push @{$$self{Cleanup}}, $sub;
5296
+ }
5297
+
5185
5298
  #------------------------------------------------------------------------------
5186
5299
  # Add warning tag
5187
5300
  # Inputs: 0) ExifTool object reference, 1) warning message
@@ -6017,8 +6130,8 @@ sub MakeTagName($)
6017
6130
  my $name = shift;
6018
6131
  $name =~ tr/-_a-zA-Z0-9//dc; # remove illegal characters
6019
6132
  $name = ucfirst $name; # capitalize first letter
6020
- $name = "Tag$name" if length($name) < 2 or $name =~ /^[-0-9]/;
6021
6133
  # must at least 2 characters long and not start with - or 0-9-
6134
+ $name = "Tag$name" if length($name) < 2 or $name =~ /^[-0-9]/;
6022
6135
  return $name;
6023
6136
  }
6024
6137
 
@@ -717,12 +717,30 @@ or undef (the default) for no base adjustment.
717
717
 
718
718
  =item Geolocation
719
719
 
720
- Flag to generate geolocation tags based on current GPSLatitude/GPSLongitude.
721
- This feature uses a database with cities over a population of 1000 from
722
- geonames.org. May be set to a string of the form "Lat,Lon" (eg.
723
- "44.56,-72.33") to act as default GPS coordinates for files not containing
724
- this information. See the comments in Geolocation.pm for more details.
725
- Default is undef.
720
+ Flag to generate geolocation tags based on the GPSLatitude/GPSLongitude or
721
+ City/State/Province/Country read from a file. This feature uses an included
722
+ database with cities over a population of 2000 from geonames.org. May be set
723
+ to a string of the form "Lat,Lon" (eg. "44.56,-72.33") or city with optional
724
+ state/province, country and/or country code (eg. "Paris,France") to act as a
725
+ default for files not containing GPS or geolocation information, or include
726
+ tag names with leading dollar signs separated by commas to specify the tags
727
+ to use for the geolocation input. May also include regular expressions for
728
+ more flexible matching. See L<https://exiftool.org/geolocation.html> for
729
+ more details. Default is undef.
730
+
731
+ =item GeolocAltNames
732
+
733
+ Flag to search alternate Geolocation city names if available (ie. if
734
+ $Image::ExifTool::Geolocation::altDir has been set). Set to 0 to disable
735
+ use of the alternate names. Default is 1.
736
+
737
+ =item GeolocFeature
738
+
739
+ Comma-separated list of feature codes to include in city search, or exclude
740
+ if the list begins with a dash (-). Valid feature codes are PPL, PPLA,
741
+ PPLA2, PPLA3, PPLA4, PPLA5, PPLC, PPLCH, PPLF, PPLG, PPLL, PPLR, PPLS, STLMT
742
+ and Other. See L<http://www.geonames.org/export/codes.html#P> for a
743
+ description of these codes. Default is undef.
726
744
 
727
745
  =item GeolocMaxDist
728
746
 
@@ -731,7 +749,8 @@ not generated if the distance is greater than this. Default is undef.
731
749
 
732
750
  =item GeolocMinPop
733
751
 
734
- Minimum population for the Geolocation city.
752
+ Minimum population for the Geolocation city. Cities smaller than this are
753
+ ignored. Default is undef.
735
754
 
736
755
  =item GeoMaxIntSecs
737
756
 
@@ -935,6 +954,14 @@ by the value of the Charset option at processing time. Default is undef.
935
954
  Flag to enable automatic print conversion. Also enables inverse
936
955
  print conversion for writing. Default is 1.
937
956
 
957
+ =item PrintCSV
958
+
959
+ Flag to directly print CSV-format output rather than extracting tags
960
+ normally. Currently this feature applies only to GM PDR data (see
961
+ L<Image::ExifTool::TagNames/GM Tags>). Setting this option automatically
962
+ sets L</IgnoreTags> to "all", and L</ExtractEmbedded> to 1. Default is
963
+ undef.
964
+
938
965
  =item QuickTimeHandler
939
966
 
940
967
  Flag set to add an 'mdir' Handler to a newly created Meta box when adding
@@ -985,8 +1012,7 @@ the list. Default is undef.
985
1012
 
986
1013
  Flag to save EXIF/TIFF format type as the family 6 group name when
987
1014
  extracting information. Without this option set, the family 6 group names
988
- are not generated. Default is undef. See the L</GetGroup> option for more
989
- details.
1015
+ are not generated. Default is undef. See L</GetGroup> for more details.
990
1016
 
991
1017
  =item SavePath
992
1018
 
@@ -2460,14 +2486,14 @@ Here is a complete list of groups for each of these families:
2460
2486
  AAC, AFCP, AIFF, APE, APP0, APP1, APP11, APP12, APP13, APP14, APP15, APP2,
2461
2487
  APP3, APP4, APP5, APP6, APP7, APP8, APP9, ASF, Audible, Canon, CanonVRD,
2462
2488
  Composite, DICOM, DNG, DV, DjVu, Ducky, EXE, EXIF, ExifTool, FITS, FLAC,
2463
- FLIR, File, Flash, FlashPix, Font, FotoStation, GIF, GIMP, GeoTiff, GoPro,
2464
- H264, HTML, ICC_Profile, ID3, IPTC, ISO, ITC, JFIF, JPEG, JSON, JUMBF,
2465
- Jpeg2000, LNK, Leaf, Lytro, M2TS, MIE, MIFF, MISB, MNG, MOI, MPC, MPEG, MPF,
2466
- MXF, MakerNotes, Matroska, Meta, Ogg, OpenEXR, Opus, PDF, PICT, PLIST, PNG,
2467
- PSP, Palm, PanasonicRaw, Parrot, PhotoCD, PhotoMechanic, Photoshop,
2468
- PostScript, PrintIM, QuickTime, RAF, RIFF, RSRC, RTF, Radiance, Rawzor,
2469
- Real, Red, SVG, SigmaRaw, Sony, Stim, Theora, Torrent, Trailer, VCard,
2470
- Vorbis, WTV, XML, XMP, ZIP
2489
+ FLIR, File, Flash, FlashPix, Font, FotoStation, GIF, GIMP, GM, GeoTiff,
2490
+ GoPro, H264, HTML, ICC_Profile, ID3, IPTC, ISO, ITC, JFIF, JPEG, JSON,
2491
+ JUMBF, Jpeg2000, LNK, Leaf, Lytro, M2TS, MIE, MIFF, MISB, MNG, MOI, MPC,
2492
+ MPEG, MPF, MXF, MakerNotes, Matroska, Meta, Ogg, OpenEXR, Opus, PDF, PICT,
2493
+ PLIST, PNG, PSP, Palm, PanasonicRaw, Parrot, PhotoCD, PhotoMechanic,
2494
+ Photoshop, PostScript, PrintIM, QuickTime, RAF, RIFF, RSRC, RTF, Radiance,
2495
+ Rawzor, Real, Red, SVG, SigmaRaw, Sony, Stim, Theora, Torrent, Trailer,
2496
+ VCard, Vorbis, WTV, XML, XMP, ZIP
2471
2497
 
2472
2498
  =item Family 1 (Specific Location):
2473
2499
 
@@ -2475,7 +2501,7 @@ AAC, AC3, AFCP, AIFF, APE, ASF, AVI1, Adobe, AdobeCM, AdobeDNG, Apple,
2475
2501
  Audible, CBOR, CIFF, CameraIFD, Canon, CanonCustom, CanonDR4, CanonRaw,
2476
2502
  CanonVRD, Casio, Chapter#, Composite, DICOM, DJI, DNG, DV, DjVu, DjVu-Meta,
2477
2503
  Ducky, EPPIM, EXE, EXIF, ExifIFD, ExifTool, FITS, FLAC, FLIR, File, Flash,
2478
- FlashPix, Font, FotoStation, FujiFilm, FujiIFD, GE, GIF, GIMP, GPS,
2504
+ FlashPix, Font, FotoStation, FujiFilm, FujiIFD, GE, GIF, GIMP, GM, GPS,
2479
2505
  GSpherical, Garmin, GeoTiff, GlobParamIFD, GoPro, GraphConv, H264, HP, HTC,
2480
2506
  HTML, HTML-dc, HTML-ncc, HTML-office, HTML-prod, HTML-vw96, HTTP-equiv,
2481
2507
  ICC-chrm, ICC-clrt, ICC-header, ICC-meas, ICC-meta, ICC-view, ICC_Profile,
@@ -1,6 +1,6 @@
1
1
  Summary: perl module for image data extraction
2
2
  Name: perl-Image-ExifTool
3
- Version: 12.78
3
+ Version: 12.82
4
4
  Release: 1
5
5
  License: Artistic/GPL
6
6
  Group: Development/Libraries/Perl
@@ -21,10 +21,10 @@
21
21
  # 10) Copy zip archive to web servers.
22
22
  # 11) Update zip file version in link and text of html/index.html.
23
23
  #------------------------------------------------------------------------------
24
- -T exiftool-12.78
25
- #--info=FileVersion=12.7.8.0
26
- #--info=ProductVersion=12.7.8.0
27
- ##"--info=Build Date=2024:03:05 14:56:34-05:00"
24
+ -T exiftool-12.82
25
+ #--info=FileVersion=12.8.2.0
26
+ #--info=ProductVersion=12.8.2.0
27
+ ##"--info=Build Date=2024:04:05 12:05:25-04:00"
28
28
  ##"--info=Bundled Perl Version=ActivePerl 5.24.0"
29
29
  ##"--info=LegalCopyright=Copyright (c) 2003-2024, Phil Harvey"
30
30
  ##"--info=ProductName=ExifTool"