exiftool_vendored 12.16.0 → 12.25.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (63) hide show
  1. checksums.yaml +4 -4
  2. data/bin/Changes +137 -1
  3. data/bin/MANIFEST +12 -0
  4. data/bin/META.json +1 -1
  5. data/bin/META.yml +1 -1
  6. data/bin/README +44 -43
  7. data/bin/config_files/acdsee.config +193 -6
  8. data/bin/config_files/cuepointlist.config +70 -0
  9. data/bin/config_files/example.config +1 -8
  10. data/bin/exiftool +139 -98
  11. data/bin/fmt_files/gpx.fmt +1 -1
  12. data/bin/fmt_files/gpx_wpt.fmt +1 -1
  13. data/bin/fmt_files/kml.fmt +1 -1
  14. data/bin/fmt_files/kml_track.fmt +1 -1
  15. data/bin/lib/Image/ExifTool.pm +158 -49
  16. data/bin/lib/Image/ExifTool.pod +94 -75
  17. data/bin/lib/Image/ExifTool/Apple.pm +3 -2
  18. data/bin/lib/Image/ExifTool/BuildTagLookup.pm +25 -14
  19. data/bin/lib/Image/ExifTool/Canon.pm +28 -3
  20. data/bin/lib/Image/ExifTool/CanonCustom.pm +19 -1
  21. data/bin/lib/Image/ExifTool/DJI.pm +6 -6
  22. data/bin/lib/Image/ExifTool/DjVu.pm +6 -5
  23. data/bin/lib/Image/ExifTool/Exif.pm +50 -22
  24. data/bin/lib/Image/ExifTool/FITS.pm +13 -2
  25. data/bin/lib/Image/ExifTool/FujiFilm.pm +19 -8
  26. data/bin/lib/Image/ExifTool/GPS.pm +24 -13
  27. data/bin/lib/Image/ExifTool/H264.pm +20 -5
  28. data/bin/lib/Image/ExifTool/ICC_Profile.pm +2 -2
  29. data/bin/lib/Image/ExifTool/JPEG.pm +6 -2
  30. data/bin/lib/Image/ExifTool/JSON.pm +24 -3
  31. data/bin/lib/Image/ExifTool/Jpeg2000.pm +361 -16
  32. data/bin/lib/Image/ExifTool/M2TS.pm +40 -4
  33. data/bin/lib/Image/ExifTool/MIE.pm +2 -2
  34. data/bin/lib/Image/ExifTool/MRC.pm +341 -0
  35. data/bin/lib/Image/ExifTool/MWG.pm +3 -3
  36. data/bin/lib/Image/ExifTool/MXF.pm +1 -1
  37. data/bin/lib/Image/ExifTool/MacOS.pm +1 -1
  38. data/bin/lib/Image/ExifTool/Microsoft.pm +298 -82
  39. data/bin/lib/Image/ExifTool/Nikon.pm +5 -5
  40. data/bin/lib/Image/ExifTool/NikonSettings.pm +25 -16
  41. data/bin/lib/Image/ExifTool/Olympus.pm +2 -2
  42. data/bin/lib/Image/ExifTool/PNG.pm +2 -2
  43. data/bin/lib/Image/ExifTool/Panasonic.pm +14 -1
  44. data/bin/lib/Image/ExifTool/PhaseOne.pm +4 -3
  45. data/bin/lib/Image/ExifTool/QuickTime.pm +148 -68
  46. data/bin/lib/Image/ExifTool/QuickTimeStream.pl +94 -34
  47. data/bin/lib/Image/ExifTool/README +5 -4
  48. data/bin/lib/Image/ExifTool/RIFF.pm +84 -12
  49. data/bin/lib/Image/ExifTool/Samsung.pm +2 -1
  50. data/bin/lib/Image/ExifTool/Shortcuts.pm +9 -0
  51. data/bin/lib/Image/ExifTool/Sony.pm +157 -49
  52. data/bin/lib/Image/ExifTool/TagInfoXML.pm +1 -0
  53. data/bin/lib/Image/ExifTool/TagLookup.pm +4079 -3987
  54. data/bin/lib/Image/ExifTool/TagNames.pod +642 -273
  55. data/bin/lib/Image/ExifTool/WriteExif.pl +1 -1
  56. data/bin/lib/Image/ExifTool/WritePostScript.pl +1 -0
  57. data/bin/lib/Image/ExifTool/WriteQuickTime.pl +44 -17
  58. data/bin/lib/Image/ExifTool/WriteXMP.pl +15 -8
  59. data/bin/lib/Image/ExifTool/Writer.pl +50 -14
  60. data/bin/lib/Image/ExifTool/XMP.pm +50 -11
  61. data/bin/perl-Image-ExifTool.spec +42 -42
  62. data/lib/exiftool_vendored/version.rb +1 -1
  63. metadata +52 -12
@@ -19,7 +19,7 @@ use Image::ExifTool qw(:DataAccess);
19
19
  use Image::ExifTool::Canon;
20
20
  use Image::ExifTool::Exif;
21
21
 
22
- $VERSION = '1.57';
22
+ $VERSION = '1.58';
23
23
 
24
24
  sub ProcessCanonCustom($$$);
25
25
  sub ProcessCanonCustom2($$$);
@@ -2098,6 +2098,24 @@ my %convPFn = ( PrintConv => \&ConvertPfn, PrintConvInv => \&ConvertPfnInv );
2098
2098
  '$val=~/(\d+)/ ? $1 : 0',
2099
2099
  '$val=~/(\d+)/ ? $1 : 0',
2100
2100
  ],
2101
+ },{ # (1DXmkIII firmware 1.3)
2102
+ Name => 'ContinuousShootingSpeed',
2103
+ Condition => '$count == 5',
2104
+ Count => 5,
2105
+ PrintConv => [
2106
+ '"Hi $val"',
2107
+ '"Cont $val"',
2108
+ '"Lo $val"',
2109
+ '"Soft $val"',
2110
+ '"Soft LS $val"',
2111
+ ],
2112
+ PrintConvInv => [
2113
+ '$val=~/(\d+)/ ? $1 : 0',
2114
+ '$val=~/(\d+)/ ? $1 : 0',
2115
+ '$val=~/(\d+)/ ? $1 : 0',
2116
+ '$val=~/(\d+)/ ? $1 : 0',
2117
+ '$val=~/(\d+)/ ? $1 : 0',
2118
+ ],
2101
2119
  },{ # others
2102
2120
  Name => 'ContinuousShootingSpeed',
2103
2121
  Count => 3,
@@ -15,7 +15,7 @@ use Image::ExifTool::Exif;
15
15
  use Image::ExifTool::XMP;
16
16
  use Image::ExifTool::GPS;
17
17
 
18
- $VERSION = '1.03';
18
+ $VERSION = '1.04';
19
19
 
20
20
  my %convFloat2 = (
21
21
  PrintConv => 'sprintf("%+.2f", $val)',
@@ -90,20 +90,20 @@ my %convFloat2 = (
90
90
  Writable => 'real',
91
91
  Avoid => 1,
92
92
  PrintConv => 'Image::ExifTool::GPS::ToDMS($self, $val, 1, "N")',
93
- PrintConvInv => 'Image::ExifTool::GPS::ToDegrees($val, 1)',
93
+ PrintConvInv => 'Image::ExifTool::GPS::ToDegrees($val, 1, "lat")',
94
94
  },
95
95
  GpsLongtitude => { # (sic)
96
96
  Name => 'GPSLongtitude',
97
97
  Writable => 'real',
98
98
  PrintConv => 'Image::ExifTool::GPS::ToDMS($self, $val, 1, "E")',
99
- PrintConvInv => 'Image::ExifTool::GPS::ToDegrees($val, 1)',
99
+ PrintConvInv => 'Image::ExifTool::GPS::ToDegrees($val, 1, "lon")',
100
100
  },
101
101
  GpsLongitude => { #PH (NC)
102
102
  Name => 'GPSLongitude',
103
103
  Writable => 'real',
104
104
  Avoid => 1,
105
105
  PrintConv => 'Image::ExifTool::GPS::ToDMS($self, $val, 1, "E")',
106
- PrintConvInv => 'Image::ExifTool::GPS::ToDegrees($val, 1)',
106
+ PrintConvInv => 'Image::ExifTool::GPS::ToDegrees($val, 1, "lon")',
107
107
  },
108
108
  FlightXSpeed => { Writable => 'real' },
109
109
  FlightYSpeed => { Writable => 'real' },
@@ -124,13 +124,13 @@ my %convFloat2 = (
124
124
  Name => 'Latitude',
125
125
  Writable => 'real',
126
126
  PrintConv => 'Image::ExifTool::GPS::ToDMS($self, $val, 1, "N")',
127
- PrintConvInv => 'Image::ExifTool::GPS::ToDegrees($val, 1)',
127
+ PrintConvInv => 'Image::ExifTool::GPS::ToDegrees($val, 1, "lat")',
128
128
  },
129
129
  Longitude => {
130
130
  Name => 'Longitude',
131
131
  Writable => 'real',
132
132
  PrintConv => 'Image::ExifTool::GPS::ToDMS($self, $val, 1, "E")',
133
- PrintConvInv => 'Image::ExifTool::GPS::ToDegrees($val, 1)',
133
+ PrintConvInv => 'Image::ExifTool::GPS::ToDegrees($val, 1, "lon")',
134
134
  },
135
135
  );
136
136
 
@@ -18,7 +18,7 @@ use strict;
18
18
  use vars qw($VERSION);
19
19
  use Image::ExifTool qw(:DataAccess :Utils);
20
20
 
21
- $VERSION = '1.06';
21
+ $VERSION = '1.07';
22
22
 
23
23
  sub ParseAnt($);
24
24
  sub ProcessAnt($$$);
@@ -227,10 +227,11 @@ Tok: for (;;) {
227
227
  last unless $tok =~ /(\\+)$/ and length($1) & 0x01;
228
228
  $tok .= '"'; # quote is part of the string
229
229
  }
230
- # must protect unescaped "$" and "@" symbols, and "\" at end of string
231
- $tok =~ s{\\(.)|([\$\@]|\\$)}{'\\'.($2 || $1)}sge;
232
- # convert C escape sequences (allowed in quoted text)
233
- $tok = eval qq{"$tok"};
230
+ # convert C escape sequences, allowed in quoted text
231
+ # (note: this only converts a few of them!)
232
+ my %esc = ( a => "\a", b => "\b", f => "\f", n => "\n",
233
+ r => "\r", t => "\t", '"' => '"', '\\' => '\\' );
234
+ $tok =~ s/\\(.)/$esc{$1}||'\\'.$1/egs;
234
235
  } else { # key name
235
236
  pos($$dataPt) = pos($$dataPt) - 1;
236
237
  # allow anything in key but whitespace, braces and double quotes
@@ -56,7 +56,7 @@ use vars qw($VERSION $AUTOLOAD @formatSize @formatName %formatNumber %intFormat
56
56
  use Image::ExifTool qw(:DataAccess :Utils);
57
57
  use Image::ExifTool::MakerNotes;
58
58
 
59
- $VERSION = '4.31';
59
+ $VERSION = '4.34';
60
60
 
61
61
  sub ProcessExif($$$);
62
62
  sub WriteExif($$$);
@@ -321,6 +321,7 @@ my %utf8StringConv = (
321
321
  my %longBin = (
322
322
  ValueConv => 'length($val) > 64 ? \$val : $val',
323
323
  ValueConvInv => '$val',
324
+ LongBinary => 1, # flag to avoid decoding values of a large array
324
325
  );
325
326
 
326
327
  # PrintConv for SampleFormat (0x153)
@@ -1452,6 +1453,7 @@ my %opcodeInfo = (
1452
1453
  1 => 'Sony Uncompressed 12-bit RAW', #IB
1453
1454
  2 => 'Sony Compressed RAW', # (lossy, ref IB)
1454
1455
  3 => 'Sony Lossless Compressed RAW', #IB
1456
+ 4 => 'Sony Lossless Compressed RAW 2', #JR (ILCE-1)
1455
1457
  },
1456
1458
  },
1457
1459
  # 0x7001 - int16u[1] (in SubIFD of Sony ARW images) - values: 0,1
@@ -1472,6 +1474,7 @@ my %opcodeInfo = (
1472
1474
  PrintConv => {
1473
1475
  256 => 'Off',
1474
1476
  257 => 'Auto',
1477
+ 272 => 'Auto (ILCE-1)', #JR
1475
1478
  511 => 'No correction params available',
1476
1479
  },
1477
1480
  },
@@ -2560,6 +2563,7 @@ my %opcodeInfo = (
2560
2563
  5 => 'Color sequential area',
2561
2564
  7 => 'Trilinear',
2562
2565
  8 => 'Color sequential linear',
2566
+ # 15 - used by DJI XT2
2563
2567
  },
2564
2568
  },
2565
2569
  0xa300 => {
@@ -3615,11 +3619,11 @@ my %opcodeInfo = (
3615
3619
  },
3616
3620
  0xc6fc => {
3617
3621
  Name => 'ProfileToneCurve',
3622
+ %longBin,
3618
3623
  Writable => 'float',
3619
3624
  WriteGroup => 'IFD0',
3620
3625
  Count => -1,
3621
3626
  Protected => 1,
3622
- Binary => 1,
3623
3627
  },
3624
3628
  0xc6fd => {
3625
3629
  Name => 'ProfileEmbedPolicy',
@@ -3744,11 +3748,11 @@ my %opcodeInfo = (
3744
3748
  },
3745
3749
  0xc726 => {
3746
3750
  Name => 'ProfileLookTableData',
3751
+ %longBin,
3747
3752
  Writable => 'float',
3748
3753
  WriteGroup => 'IFD0',
3749
3754
  Count => -1,
3750
3755
  Protected => 1,
3751
- Binary => 1,
3752
3756
  },
3753
3757
  0xc740 => { Name => 'OpcodeList1', %opcodeInfo }, # DNG 1.3
3754
3758
  0xc741 => { Name => 'OpcodeList2', %opcodeInfo }, # DNG 1.3
@@ -4728,8 +4732,8 @@ my %subSecConv = (
4728
4732
  },
4729
4733
  LensID => {
4730
4734
  Groups => { 2 => 'Camera' },
4735
+ Require => 'LensType',
4731
4736
  Desire => {
4732
- 0 => 'LensType',
4733
4737
  1 => 'FocalLength',
4734
4738
  2 => 'MaxAperture',
4735
4739
  3 => 'MaxApertureValue',
@@ -4748,25 +4752,16 @@ my %subSecConv = (
4748
4752
  Applies only to LensType values with a lookup table. May be configured
4749
4753
  by adding user-defined lenses
4750
4754
  },
4751
- # this LensID is only valid if the LensType has a PrintConv,
4752
- # or LensType or LensModel are the model name
4755
+ # this LensID is only valid if the LensType has a PrintConv or is a model name
4753
4756
  RawConv => q{
4754
4757
  my $printConv = $$self{TAG_INFO}{LensType}{PrintConv};
4755
- return $val if ref $printConv eq 'HASH' or
4756
- (ref $printConv eq 'ARRAY' and ref $$printConv[0] eq 'HASH') or
4757
- (defined $val[0] and $val[0] =~ /(mm|\d\/F)/) or
4758
- (defined $val[6] and $val[6] =~ /(mm|\d\/F)/);
4758
+ return $val if ref $printConv eq 'HASH' or (ref $printConv eq 'ARRAY' and
4759
+ ref $$printConv[0] eq 'HASH') or $val[0] =~ /(mm|\d\/F)/;
4759
4760
  return undef;
4760
4761
  },
4761
- ValueConv => '$val[0] || $val[6]',
4762
+ ValueConv => '$val',
4762
4763
  PrintConv => q{
4763
4764
  my $pcv;
4764
- # use LensModel ([6]) if LensType ([0]) is not populated
4765
- # (iPhone populates LensModel but not LensType)
4766
- if (not defined $val[0] and defined $val[6]) {
4767
- $val[0] = $val[6];
4768
- $prt[0] = $prt[6];
4769
- }
4770
4765
  # use LensType2 instead of LensType if available and valid (Sony E-mount lenses)
4771
4766
  # (0x8000 or greater; 0 for several older/3rd-party E-mount lenses)
4772
4767
  if (defined $val[9] and ($val[9] & 0x8000 or $val[9] == 0)) {
@@ -4794,6 +4789,30 @@ my %subSecConv = (
4794
4789
  return $lens;
4795
4790
  },
4796
4791
  },
4792
+ 'LensID-2' => {
4793
+ Name => 'LensID',
4794
+ Groups => { 2 => 'Camera' },
4795
+ Desire => {
4796
+ 0 => 'LensModel',
4797
+ 1 => 'Lens',
4798
+ 2 => 'XMP-aux:LensID',
4799
+ 3 => 'Make',
4800
+ },
4801
+ Inhibit => {
4802
+ 4 => 'Composite:LensID',
4803
+ },
4804
+ RawConv => q{
4805
+ return undef if defined $val[2] and defined $val[3];
4806
+ return $val if defined $val[0] and $val[0] =~ /(mm|\d\/F)/;
4807
+ return $val if defined $val[1] and $val[1] =~ /(mm|\d\/F)/;
4808
+ return undef;
4809
+ },
4810
+ ValueConv => q{
4811
+ return $val[0] if defined $val[0] and $val[0] =~ /(mm|\d\/F)/;
4812
+ return $val[1];
4813
+ },
4814
+ PrintConv => '$_=$val; s/(\d)\/F/$1mm F/; s/mmF/mm F/; s/(\d) mm/${1}mm/; s/ - /-/; $_',
4815
+ },
4797
4816
  );
4798
4817
 
4799
4818
  # table for unknown IFD entries
@@ -5780,7 +5799,8 @@ sub ProcessExif($$$)
5780
5799
  $numEntries = Get16u($dataPt, $dirStart);
5781
5800
  } else {
5782
5801
  $et->Warn("Bad $dir directory", $inMakerNotes);
5783
- return 0 unless $inMakerNotes and $dirLen >= 14;
5802
+ return 0 unless $inMakerNotes and $dirLen >= 14 and $dirStart >= 0 and
5803
+ $dirStart + $dirLen <= length($$dataPt);
5784
5804
  $dirSize = $dirLen;
5785
5805
  $numEntries = int(($dirSize - 2) / 12); # read what we can
5786
5806
  Set16u($numEntries, $dataPt, $dirStart);
@@ -6153,15 +6173,23 @@ sub ProcessExif($$$)
6153
6173
  # (avoids long delays when processing some corrupted files)
6154
6174
  if ($count > 100000 and $formatStr !~ /^(undef|string|binary)$/) {
6155
6175
  my $tagName = $tagInfo ? $$tagInfo{Name} : sprintf('tag 0x%.4x', $tagID);
6176
+ # (count of 196608 is typical for ColorMap)
6156
6177
  if ($tagName ne 'TransferFunction' or $count != 196608) {
6157
6178
  my $minor = $count > 2000000 ? 0 : 2;
6158
6179
  next if $et->Warn("Ignoring $dirName $tagName with excessive count", $minor);
6159
6180
  }
6160
6181
  }
6161
- # convert according to specified format
6162
- $val = ReadValue($valueDataPt,$valuePtr,$formatStr,$count,$readSize,\$rational);
6163
- # re-code if necessary
6164
- $val = $et->Decode($val, $strEnc) if $strEnc and $formatStr eq 'string' and defined $val;
6182
+ if ($count > 500 and $formatStr !~ /^(undef|string|binary)$/ and
6183
+ (not $tagInfo or $$tagInfo{LongBinary}) and not $$et{OPTIONS}{IgnoreMinorErrors})
6184
+ {
6185
+ $et->WarnOnce('Not decoding some large array(s). Ignore minor errors to decode', 2);
6186
+ $val = "(large array of $count $formatStr values)";
6187
+ } else {
6188
+ # convert according to specified format
6189
+ $val = ReadValue($valueDataPt,$valuePtr,$formatStr,$count,$readSize,\$rational);
6190
+ # re-code if necessary
6191
+ $val = $et->Decode($val, $strEnc) if $strEnc and $formatStr eq 'string' and defined $val;
6192
+ }
6165
6193
  }
6166
6194
 
6167
6195
  if ($verbose) {
@@ -14,7 +14,7 @@ use strict;
14
14
  use vars qw($VERSION);
15
15
  use Image::ExifTool qw(:DataAccess :Utils);
16
16
 
17
- $VERSION = '1.00';
17
+ $VERSION = '1.02';
18
18
 
19
19
  # FITS tags (ref 1)
20
20
  %Image::ExifTool::FITS::Main = (
@@ -36,6 +36,10 @@ $VERSION = '1.00';
36
36
  'TIME-OBS'=> { Name => 'ObservationTime', Groups => { 2 => 'Time' } },
37
37
  'DATE-END'=> { Name => 'ObservationDateEnd', Groups => { 2 => 'Time' } },
38
38
  'TIME-END'=> { Name => 'ObservationTimeEnd', Groups => { 2 => 'Time' } },
39
+ COMMENT => { Name => 'Comment', PrintConv => '$val =~ s/^ +//; $val',
40
+ Notes => 'leading spaces are removed if L<PrintConv|../ExifTool.html#PrintConv> is enabled' },
41
+ HISTORY => { Name => 'History', PrintConv => '$val =~ s/^ +//; $val',
42
+ Notes => 'leading spaces are removed if L<PrintConv|../ExifTool.html#PrintConv> is enabled' },
39
43
  );
40
44
 
41
45
  #------------------------------------------------------------------------------
@@ -67,7 +71,14 @@ sub ProcessFITS($$)
67
71
  last if $key eq 'END';
68
72
  # make sure the key is valid
69
73
  $key =~ /^[-_A-Z0-9]*$/ or $et->Warn('Format error in FITS header'), last;
70
- next unless substr($buff,8,2) eq '= '; # ignore comment lines
74
+ if ($key eq 'COMMENT' or $key eq 'HISTORY') {
75
+ my $val = substr($buff, 8); # comments start in column 9
76
+ $val =~ s/ +$//; # remove trailing spaces
77
+ $et->HandleTag($tagTablePtr, $key, $val);
78
+ next;
79
+ }
80
+ # ignore other lines that aren't tags
81
+ next unless substr($buff,8,2) eq '= ';
71
82
  # save tag name (avoiding potential conflict with ExifTool variables)
72
83
  $tag = $Image::ExifTool::specialTags{$key} ? "_$key" : $key;
73
84
  # add to tag table if necessary
@@ -31,7 +31,7 @@ use vars qw($VERSION);
31
31
  use Image::ExifTool qw(:DataAccess :Utils);
32
32
  use Image::ExifTool::Exif;
33
33
 
34
- $VERSION = '1.78';
34
+ $VERSION = '1.80';
35
35
 
36
36
  sub ProcessFujiDir($$$);
37
37
  sub ProcessFaceRec($$$);
@@ -507,6 +507,7 @@ my %faceCategories = (
507
507
  0 => 'Off',
508
508
  1 => 'On',
509
509
  2 => 'No flash & flash', #3
510
+ 6 => 'Pixel Shift', #IB (GFX100S)
510
511
  },
511
512
  }],
512
513
  0x1101 => {
@@ -517,6 +518,8 @@ my %faceCategories = (
517
518
  Name => 'DriveSettings',
518
519
  SubDirectory => { TagTable => 'Image::ExifTool::FujiFilm::DriveSettings' },
519
520
  },
521
+ 0x1105 => { Name => 'PixelShiftShots', Writable => 'int16u' }, #IB
522
+ 0x1106 => { Name => 'PixelShiftOffset', Writable => 'rational64s', Count => 2 }, #IB
520
523
  # (0x1150-0x1152 exist only for Pro Low-light and Pro Focus PictureModes)
521
524
  # 0x1150 - Pro Low-light - val=1; Pro Focus - val=2 (ref 7); HDR - val=128 (forum10799)
522
525
  # 0x1151 - Pro Low-light - val=4 (number of pictures taken?); Pro Focus - val=2,3 (ref 7); HDR - val=3 (forum10799)
@@ -623,6 +626,7 @@ my %faceCategories = (
623
626
  0x700 => 'Eterna', #12
624
627
  0x800 => 'Classic Negative', #forum10536
625
628
  0x900 => 'Bleach Bypass', #forum10890
629
+ 0xa00 => 'Nostalgic Neg', #forum12085
626
630
  },
627
631
  },
628
632
  0x1402 => { #2
@@ -914,15 +918,22 @@ my %faceCategories = (
914
918
  WRITABLE => 1,
915
919
  0.1 => {
916
920
  Name => 'FocusMode2',
917
- Mask => 0x000000ff,
921
+ Mask => 0x0000000f,
918
922
  PrintConv => {
919
- 0x00 => 'AF-M',
920
- 0x01 => 'AF-S',
921
- 0x02 => 'AF-C',
922
- 0x11 => 'AF-S (Auto)',
923
+ 0x0 => 'AF-M',
924
+ 0x1 => 'AF-S',
925
+ 0x2 => 'AF-C',
923
926
  },
924
927
  },
925
928
  0.2 => {
929
+ Name => 'PreAF',
930
+ Mask => 0x00f0,
931
+ PrintConv => {
932
+ 0 => 'Off',
933
+ 1 => 'On',
934
+ },
935
+ },
936
+ 0.3 => {
926
937
  Name => 'AFAreaMode',
927
938
  Mask => 0x0f00,
928
939
  PrintConv => {
@@ -931,7 +942,7 @@ my %faceCategories = (
931
942
  2 => 'Wide/Tracking',
932
943
  },
933
944
  },
934
- 0.3 => {
945
+ 0.4 => {
935
946
  Name => 'AFAreaPointSize',
936
947
  Mask => 0xf000,
937
948
  PrintConv => {
@@ -939,7 +950,7 @@ my %faceCategories = (
939
950
  OTHER => sub { return $_[0] },
940
951
  },
941
952
  },
942
- 0.4 => {
953
+ 0.5 => {
943
954
  Name => 'AFAreaZoneSize',
944
955
  Mask => 0xf0000,
945
956
  PrintConv => {
@@ -12,13 +12,12 @@ use strict;
12
12
  use vars qw($VERSION);
13
13
  use Image::ExifTool::Exif;
14
14
 
15
- $VERSION = '1.51';
15
+ $VERSION = '1.53';
16
16
 
17
17
  my %coordConv = (
18
18
  ValueConv => 'Image::ExifTool::GPS::ToDegrees($val)',
19
19
  ValueConvInv => 'Image::ExifTool::GPS::ToDMS($self, $val)',
20
20
  PrintConv => 'Image::ExifTool::GPS::ToDMS($self, $val, 1)',
21
- PrintConvInv => 'Image::ExifTool::GPS::ToDegrees($val)',
22
21
  );
23
22
 
24
23
  %Image::ExifTool::GPS::Main = (
@@ -41,7 +40,7 @@ my %coordConv = (
41
40
  Notes => q{
42
41
  tags 0x0001-0x0006 used for camera location according to MWG 2.0. ExifTool
43
42
  will also accept a number when writing GPSLatitudeRef, positive for north
44
- latitudes or negative for south, or a string ending in N or S
43
+ latitudes or negative for south, or a string containing N, North, S or South
45
44
  },
46
45
  Count => 2,
47
46
  PrintConv => {
@@ -50,8 +49,8 @@ my %coordConv = (
50
49
  OTHER => sub {
51
50
  my ($val, $inv) = @_;
52
51
  return undef unless $inv;
53
- return uc $1 if $val =~ /\b([NS])$/i;
54
- return $1 eq '-' ? 'S' : 'N' if $val =~ /^([-+]?)\d+(\.\d*)?$/;
52
+ return uc $2 if $val =~ /(^|[^A-Z])([NS])(orth|outh)?\b/i;
53
+ return $1 eq '-' ? 'S' : 'N' if $val =~ /([-+]?)\d+/;
55
54
  return undef;
56
55
  },
57
56
  N => 'North',
@@ -63,6 +62,7 @@ my %coordConv = (
63
62
  Writable => 'rational64u',
64
63
  Count => 3,
65
64
  %coordConv,
65
+ PrintConvInv => 'Image::ExifTool::GPS::ToDegrees($val,undef,"lat")',
66
66
  },
67
67
  0x0003 => {
68
68
  Name => 'GPSLongitudeRef',
@@ -70,7 +70,7 @@ my %coordConv = (
70
70
  Count => 2,
71
71
  Notes => q{
72
72
  ExifTool will also accept a number when writing this tag, positive for east
73
- longitudes or negative for west, or a string ending in E or W
73
+ longitudes or negative for west, or a string containing E, East, W or West
74
74
  },
75
75
  PrintConv => {
76
76
  # extract E/W if written from Composite:GPSLongitude
@@ -78,8 +78,8 @@ my %coordConv = (
78
78
  OTHER => sub {
79
79
  my ($val, $inv) = @_;
80
80
  return undef unless $inv;
81
- return uc $1 if $val =~ /\b([EW])$/i;
82
- return $1 eq '-' ? 'W' : 'E' if $val =~ /^([-+]?)\d+(\.\d*)?$/;
81
+ return uc $2 if $val =~ /(^|[^A-Z])([EW])(ast|est)?\b/i;
82
+ return $1 eq '-' ? 'W' : 'E' if $val =~ /([-+]?)\d+/;
83
83
  return undef;
84
84
  },
85
85
  E => 'East',
@@ -91,6 +91,7 @@ my %coordConv = (
91
91
  Writable => 'rational64u',
92
92
  Count => 3,
93
93
  %coordConv,
94
+ PrintConvInv => 'Image::ExifTool::GPS::ToDegrees($val,undef,"lon")',
94
95
  },
95
96
  0x0005 => {
96
97
  Name => 'GPSAltitudeRef',
@@ -238,6 +239,7 @@ my %coordConv = (
238
239
  Writable => 'rational64u',
239
240
  Count => 3,
240
241
  %coordConv,
242
+ PrintConvInv => 'Image::ExifTool::GPS::ToDegrees($val,undef,"lat")',
241
243
  },
242
244
  0x0015 => {
243
245
  Name => 'GPSDestLongitudeRef',
@@ -250,6 +252,7 @@ my %coordConv = (
250
252
  Writable => 'rational64u',
251
253
  Count => 3,
252
254
  %coordConv,
255
+ PrintConvInv => 'Image::ExifTool::GPS::ToDegrees($val,undef,"lon")',
253
256
  },
254
257
  0x0017 => {
255
258
  Name => 'GPSDestBearingRef',
@@ -529,18 +532,26 @@ sub ToDMS($$;$$)
529
532
  #------------------------------------------------------------------------------
530
533
  # Convert to decimal degrees
531
534
  # Inputs: 0) a string containing 1-3 decimal numbers and any amount of other garbage
532
- # 1) true if value should be negative if coordinate ends in 'S' or 'W'
533
- # Returns: Coordinate in degrees
534
- sub ToDegrees($;$)
535
+ # 1) true if value should be negative if coordinate ends in 'S' or 'W',
536
+ # 2) 'lat' or 'lon' to extract lat or lon from GPSCoordinates string
537
+ # Returns: Coordinate in degrees, or '' on error
538
+ sub ToDegrees($;$$)
535
539
  {
536
- my ($val, $doSign) = @_;
540
+ my ($val, $doSign, $coord) = @_;
537
541
  return '' if $val =~ /\b(inf|undef)\b/; # ignore invalid values
542
+ # use only lat or lon part of combined GPSCoordinates inputs
543
+ if ($coord and ($coord eq 'lat' or $coord eq 'lon') and
544
+ # (two formatted coordinate values with cardinal directions, separated by a comma)
545
+ $val =~ /^(.*(?:N(?:orth)?|S(?:outh)?)),\s*(.*(?:E(?:ast)?|W(?:est)?))$/i)
546
+ {
547
+ $val = $coord eq 'lat' ? $1 : $2;
548
+ }
538
549
  # extract decimal or floating point values out of any other garbage
539
550
  my ($d, $m, $s) = ($val =~ /((?:[+-]?)(?=\d|\.\d)\d*(?:\.\d*)?(?:[Ee][+-]\d+)?)/g);
540
551
  return '' unless defined $d;
541
552
  my $deg = $d + (($m || 0) + ($s || 0)/60) / 60;
542
553
  # make negative if S or W coordinate
543
- $deg = -$deg if $doSign ? $val =~ /[^A-Z](S|W)$/i : $deg < 0;
554
+ $deg = -$deg if $doSign ? $val =~ /[^A-Z](S(outh)?|W(est)?)\s*$/i : $deg < 0;
544
555
  return $deg;
545
556
  }
546
557