exiftool_vendored 12.18.0 → 12.22.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of exiftool_vendored might be problematic. Click here for more details.

Files changed (41) hide show
  1. checksums.yaml +4 -4
  2. data/bin/Changes +54 -0
  3. data/bin/MANIFEST +1 -0
  4. data/bin/META.json +1 -1
  5. data/bin/META.yml +1 -1
  6. data/bin/README +2 -2
  7. data/bin/config_files/example.config +1 -8
  8. data/bin/exiftool +70 -32
  9. data/bin/fmt_files/gpx.fmt +1 -1
  10. data/bin/fmt_files/gpx_wpt.fmt +1 -1
  11. data/bin/fmt_files/kml.fmt +1 -1
  12. data/bin/fmt_files/kml_track.fmt +1 -1
  13. data/bin/lib/Image/ExifTool.pm +74 -24
  14. data/bin/lib/Image/ExifTool.pod +33 -25
  15. data/bin/lib/Image/ExifTool/Apple.pm +3 -2
  16. data/bin/lib/Image/ExifTool/BuildTagLookup.pm +20 -10
  17. data/bin/lib/Image/ExifTool/Canon.pm +6 -1
  18. data/bin/lib/Image/ExifTool/DJI.pm +6 -6
  19. data/bin/lib/Image/ExifTool/Exif.pm +5 -2
  20. data/bin/lib/Image/ExifTool/FITS.pm +13 -2
  21. data/bin/lib/Image/ExifTool/GPS.pm +22 -11
  22. data/bin/lib/Image/ExifTool/ICC_Profile.pm +2 -2
  23. data/bin/lib/Image/ExifTool/M2TS.pm +40 -4
  24. data/bin/lib/Image/ExifTool/MIE.pm +2 -2
  25. data/bin/lib/Image/ExifTool/Microsoft.pm +296 -82
  26. data/bin/lib/Image/ExifTool/Nikon.pm +2 -1
  27. data/bin/lib/Image/ExifTool/Olympus.pm +2 -2
  28. data/bin/lib/Image/ExifTool/QuickTime.pm +28 -12
  29. data/bin/lib/Image/ExifTool/QuickTimeStream.pl +6 -5
  30. data/bin/lib/Image/ExifTool/Shortcuts.pm +9 -0
  31. data/bin/lib/Image/ExifTool/Sony.pm +51 -17
  32. data/bin/lib/Image/ExifTool/TagInfoXML.pm +1 -0
  33. data/bin/lib/Image/ExifTool/TagLookup.pm +4031 -4022
  34. data/bin/lib/Image/ExifTool/TagNames.pod +130 -95
  35. data/bin/lib/Image/ExifTool/WriteExif.pl +1 -1
  36. data/bin/lib/Image/ExifTool/WriteQuickTime.pl +7 -5
  37. data/bin/lib/Image/ExifTool/Writer.pl +43 -10
  38. data/bin/lib/Image/ExifTool/XMP.pm +4 -4
  39. data/bin/perl-Image-ExifTool.spec +1 -1
  40. data/lib/exiftool_vendored/version.rb +1 -1
  41. metadata +20 -6
@@ -627,8 +627,9 @@ Flag to extract information from embedded documents in EPS files, embedded
627
627
  EPS information and JPEG and Jpeg2000 images in PDF files, embedded MPF
628
628
  images in JPEG and MPO files, timed metadata in videos, and the resource
629
629
  fork of Mac OS files. A setting of 2 also causes the H264 video stream in
630
- MP4 files to be parsed until the first SEI message is decoded, or 3 to
631
- parse the entire stream. Default is undef.
630
+ MP4 files to be parsed until the first SEI message is decoded, or 3 to parse
631
+ the entire H264 stream in MP4 videos and the entire M2TS file to look for
632
+ any unlisted program containing GPS metadata. Default is undef.
632
633
 
633
634
  =item FastScan
634
635
 
@@ -737,8 +738,8 @@ group names.
737
738
 
738
739
  =item HexTagIDs
739
740
 
740
- Use hexadecimal instead of decimal for the family 7 group names of tags with
741
- numerical ID's.
741
+ Return hexadecimal instead of decimal for the family 7 group names of tags
742
+ with numerical ID's.
742
743
 
743
744
  =item HtmlDump
744
745
 
@@ -843,8 +844,9 @@ print conversion for writing. Default is 1.
843
844
 
844
845
  Flag set to add an 'mdir' Handler to a newly created Meta box when adding
845
846
  QuickTime ItemList tags. Adobe Bridge does not add this Handler, but it is
846
- commonly found in samples from other software, so it is possible that this
847
- could affect the interoperability of ItemList tags. Default is undef.
847
+ commonly found in samples from other software, and it has been reported that
848
+ Apple QuickTime Player and Photos.apps will ignore ItemList tags if this is
849
+ missing. Default is 1.
848
850
 
849
851
  =item QuickTimeUTC
850
852
 
@@ -2049,6 +2051,7 @@ The group family numbers are currently available:
2049
2051
  4) Instance Number (eg. Copy1, Copy2, Copy3...)
2050
2052
  5) Metadata Path (eg. JPEG-APP1-IFD0-ExifIFD)
2051
2053
  6) EXIF/TIFF Format (eg. int8u, int32u, undef, string)
2054
+ 7) Tag ID (eg. ID-271, ID-rights, ID-a9aut)
2052
2055
 
2053
2056
  Families 0 and 1 are based on the file structure, and are similar except
2054
2057
  that family 1 is more specific and sub-divides some groups to give more
@@ -2092,13 +2095,14 @@ Family 6 is currently used only for EXIF/TIFF metadata, and gives the format
2092
2095
  type of the extracted value. Generated only if the L</SaveFormat> option is
2093
2096
  used when extracting.
2094
2097
 
2095
- Family 7 is used for tag ID's. The group names are "ID-" followed by the
2096
- tag ID with characters other than [-_A-Za-z0-9] converted to hex. Numerical
2097
- tag ID's are given in hex if the L</HexTagIDs> option is set. When
2098
- specifying a family 7 group name, numerical ID's may be in hex or decimal,
2099
- and non-numercal ID's may or may not have characters other than
2100
- [-_A-Za-z0-9] converted to hex. Note that unlike other group names, family
2101
- 7 group names are case sensitive (except for the leading "ID-").
2098
+ Family 7 is used for tag ID's. The group names are the actual tag ID's,
2099
+ with a leading "ID-" string. Non-numerical ID's have characters other than
2100
+ [-_A-Za-z0-9] converted to hex. Numerical tag ID's are returned in hex if
2101
+ the L</HexTagIDs> option is set, otherwise decimal is used. When specifying
2102
+ a family 7 group name, numerical ID's may be in hex or decimal, and
2103
+ non-numerical ID's may or may not have characters other than [-_A-Za-z0-9]
2104
+ converted to hex. Note that unlike other group names, the tag ID's of
2105
+ family 7 group names are case sensitive (but the leading "ID-" is not).
2102
2106
 
2103
2107
  See L</GetAllGroups [static]> for complete lists of group names.
2104
2108
 
@@ -2255,7 +2259,7 @@ Get list of all group names in specified family.
2255
2259
 
2256
2260
  =item Inputs:
2257
2261
 
2258
- 0) Group family number (0-4)
2262
+ 0) Group family number (0-7)
2259
2263
 
2260
2264
  =item Return Values:
2261
2265
 
@@ -2344,12 +2348,16 @@ rational64s, float, double, ifd, unicode, complex, int64u, int64s, ifd64
2344
2348
 
2345
2349
  =item Family 7 (Tag ID):
2346
2350
 
2347
- ID-xxx (where xxx is the tag ID. Numerical ID's are given in hex with a
2348
- leading "0x" if the HexTagIDs option is set, as are characters in
2349
- non-numerical ID's which are not valid in a group name)
2351
+ ID-xxx (Where xxx is the tag ID. Numerical ID's are returned in hex with a
2352
+ leading "0x" if the HexTagIDs option is set, or decimal otherwise.
2353
+ Characters in non-numerical ID's which are not valid in a group name are
2354
+ returned as 2 hex digits.)
2350
2355
 
2351
2356
  =back
2352
2357
 
2358
+ Note: This function may also be called as an ExifTool member function to
2359
+ allow the HexTagIDs option to be set when retrieving family 7 group names.
2360
+
2353
2361
  =head2 GetDeleteGroups [static]
2354
2362
 
2355
2363
  Get list of all deletable group names.
@@ -2367,14 +2375,14 @@ None.
2367
2375
  A list of deletable group names in alphabetical order. The current list of
2368
2376
  deletable group names is:
2369
2377
 
2370
- AFCP, APP0, APP1, APP10, APP11, APP12, APP13, APP14, APP15, APP2, APP3,
2371
- APP4, APP5, APP6, APP7, APP8, APP9, Adobe, Audio, Author, CIFF, Camera,
2372
- CanonVRD, Document, Ducky, EXIF, ExifIFD, ExifTool, File, FlashPix,
2373
- FotoStation, GPS, GlobParamIFD, ICC_Profile, IFD0, IFD1, IPTC, Image,
2374
- InteropIFD, JFIF, Jpeg2000, Location, MIE, MPF, MakerNotes, Meta, MetaIFD,
2375
- NikonCapture, Other, PDF, PDF-update, PNG, PNG-pHYs, PhotoMechanic,
2376
- Photoshop, Preview, PrintIM, Printing, RMETA, RSRC, SubIFD, Time, Trailer,
2377
- Video, XML, XML-*, XMP, XMP-*
2378
+ Adobe, AFCP, APP0, APP1, APP10, APP11, APP12, APP13, APP14, APP15, APP2,
2379
+ APP3, APP4, APP5, APP6, APP7, APP8, APP9, Audio, Author, Camera, CanonVRD,
2380
+ CIFF, Document, Ducky, EXIF, ExifIFD, ExifTool, File, FlashPix, FotoStation,
2381
+ GlobParamIFD, GPS, ICC_Profile, IFD0, IFD1, Image, Insta360, InteropIFD,
2382
+ IPTC, ItemList, JFIF, Jpeg2000, Keys, Location, MakerNotes, Meta, MetaIFD,
2383
+ Microsoft, MIE, MPF, NikonCapture, Other, PDF, PDF-update, PhotoMechanic,
2384
+ Photoshop, PNG, PNG-pHYs, Preview, PrintIM, Printing, QuickTime, RMETA,
2385
+ RSRC, SubIFD, Time, Trailer, UserData, Video, XML, XML-*, XMP, XMP-*
2378
2386
 
2379
2387
  To schedule a group for deletion, call L</SetNewValue> with a tag name like
2380
2388
  'EXIF:*' and an undefined tag value.
@@ -15,7 +15,7 @@ use vars qw($VERSION);
15
15
  use Image::ExifTool::Exif;
16
16
  use Image::ExifTool::PLIST;
17
17
 
18
- $VERSION = '1.04';
18
+ $VERSION = '1.05';
19
19
 
20
20
  # Apple iPhone metadata (ref PH)
21
21
  %Image::ExifTool::Apple::Main = (
@@ -72,7 +72,8 @@ $VERSION = '1.04';
72
72
  # 0x000f - int32s: 2,3
73
73
  # 0x0010 - int32s: 1
74
74
  0x0011 => {
75
- Name => 'ContentIdentifier', #forum8750
75
+ Name => 'MediaGroupUUID', #NealKrawetz private communication
76
+ # (changed in 12.19 from Name => 'ContentIdentifier', #forum8750)
76
77
  Writable => 'string',
77
78
  },
78
79
  # 0x0014 - int32s: 1,2,3,4,5 (iPhone 6s, iOS 6.1)
@@ -35,7 +35,7 @@ use Image::ExifTool::Sony;
35
35
  use Image::ExifTool::Validate;
36
36
  use Image::ExifTool::MacOS;
37
37
 
38
- $VERSION = '3.41';
38
+ $VERSION = '3.44';
39
39
  @ISA = qw(Exporter);
40
40
 
41
41
  sub NumbersFirst($$);
@@ -141,6 +141,9 @@ my %formatOK = (
141
141
  signed => 1,
142
142
  unsigned => 1,
143
143
  utf8 => 1,
144
+ Unicode => 1, # (Microsoft Xtra)
145
+ GUID => 1, # (Microsoft Xtra)
146
+ vt_filetime => 1, # (Microsoft Xtra)
144
147
  );
145
148
 
146
149
  # Descriptions for the TagNames documentation
@@ -431,11 +434,13 @@ L<UserData|Image::ExifTool::TagNames/QuickTime UserData Tags>, and
431
434
  finally in L<Keys|Image::ExifTool::TagNames/QuickTime Keys Tags>,
432
435
  but this order may be changed by setting the PREFERRED level of the
433
436
  appropriate table in the config file (see
434
- L<example.config|../config.html#PREF> in the full distribution for
435
- an example). ExifTool currently writes only top-level metadata in
436
- QuickTime-based files; it extracts other track-specific and timed
437
- metadata, but can not yet edit tags in these locations (with the
438
- exception of track-level date/time tags).
437
+ L<example.config|../config.html#PREF> in the full distribution for an
438
+ example). Note that some tags with the same name but different ID's may
439
+ exist in the same location, but the family 7 group names may be used to
440
+ differentiate these. ExifTool currently writes only top-level metadata in
441
+ QuickTime-based files; it extracts other track-specific and timed metadata,
442
+ but can not yet edit tags in these locations (with the exception of
443
+ track-level date/time tags).
439
444
 
440
445
  Alternate language tags may be accessed for
441
446
  L<ItemList|Image::ExifTool::TagNames/QuickTime ItemList Tags> and
@@ -460,8 +465,8 @@ local time when extracting.
460
465
 
461
466
  When writing string-based date/time tags, the system time zone is added if
462
467
  the PrintConv option is enabled and no time zone is specified. This is
463
- because Apple software may display a crazy values if the time zone is
464
- missing for some tags.
468
+ because Apple software may display crazy values if the time zone is missing
469
+ for some tags.
465
470
 
466
471
  See
467
472
  L<https://developer.apple.com/library/archive/documentation/QuickTime/QTFF/>
@@ -699,10 +704,14 @@ my %shortcutNotes = (
699
704
  large binary data tags which may be excluded to reduce memory usage if
700
705
  memory limitations are a problem
701
706
  },
707
+ 'ls-l' => q{
708
+ mimics columns shown by Unix "ls -l" command. Includes some tags which are
709
+ extracted only if the API L<SystemTags|../ExifTool.html#SystemTags> option
710
+ is enabled
711
+ },
702
712
  );
703
713
 
704
-
705
- # same thing for RIFF INFO tags found in the EXIF spec
714
+ # lookup for RIFF INFO tags which are found in the EXIF spec
706
715
  my %riffSpec = (
707
716
  IARL => 1, ICRD => 1, IGNR => 1, IPLT => 1, ISRC => 1,
708
717
  IART => 1, ICRP => 1, IKEY => 1, IPRD => 1, ISRF => 1,
@@ -1320,6 +1329,7 @@ TagID: foreach $tagID (@keys) {
1320
1329
  my $count = $$tagInfo{Count} || 1;
1321
1330
  # adjust count to Writable size if different than Format
1322
1331
  if ($writable and $format and $writable ne $format and
1332
+ $writable ne 'string' and $format ne 'string' and
1323
1333
  $Image::ExifTool::Exif::formatNumber{$writable} and
1324
1334
  $Image::ExifTool::Exif::formatNumber{$format})
1325
1335
  {
@@ -88,7 +88,7 @@ sub ProcessCTMD($$$);
88
88
  sub ProcessExifInfo($$$);
89
89
  sub SwapWords($);
90
90
 
91
- $VERSION = '4.44';
91
+ $VERSION = '4.46';
92
92
 
93
93
  # Note: Removed 'USM' from 'L' lenses since it is redundant - PH
94
94
  # (or is it? Ref 32 shows 5 non-USM L-type lenses)
@@ -589,6 +589,8 @@ $VERSION = '4.44';
589
589
  61182.18 => 'Canon RF 100-500mm F4.5-7.1L IS USM',
590
590
  61182.19 => 'Canon RF 100-500mm F4.5-7.1L IS USM + RF1.4x',
591
591
  61182.20 => 'Canon RF 100-500mm F4.5-7.1L IS USM + RF2x',
592
+ 61182.21 => 'Canon RF 70-200mm F4L IS USM', #42
593
+ 61182.22 => 'Canon RF 50mm F1.8 STM', #42
592
594
  65535 => 'n/a',
593
595
  );
594
596
 
@@ -945,6 +947,7 @@ $VERSION = '4.44';
945
947
  0x80000437 => 'EOS 90D', #IB
946
948
  0x80000453 => 'EOS R6', #PH
947
949
  0x80000467 => 'PowerShot ZOOM',
950
+ 0x80000468 => 'EOS M50 Mark II / Kiss M2', #IB
948
951
  0x80000520 => 'EOS D2000C', #IB
949
952
  0x80000560 => 'EOS D6000C', #PH (guess)
950
953
  );
@@ -6754,6 +6757,8 @@ my %ciMaxFocal = (
6754
6757
  275 => 'Canon RF 100-500mm F4.5-7.1L IS USM',
6755
6758
  276 => 'Canon RF 100-500mm F4.5-7.1L IS USM + RF1.4x',
6756
6759
  277 => 'Canon RF 100-500mm F4.5-7.1L IS USM + RF2x',
6760
+ 278 => 'Canon RF 70-200mm F4L IS USM', #42
6761
+ 280 => 'Canon RF 50mm F1.8 STM', #42
6757
6762
  # Note: add new RF lenses to %canonLensTypes with ID 61182
6758
6763
  },
6759
6764
  },
@@ -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
 
@@ -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.32';
59
+ $VERSION = '4.33';
60
60
 
61
61
  sub ProcessExif($$$);
62
62
  sub WriteExif($$$);
@@ -1452,6 +1452,7 @@ my %opcodeInfo = (
1452
1452
  1 => 'Sony Uncompressed 12-bit RAW', #IB
1453
1453
  2 => 'Sony Compressed RAW', # (lossy, ref IB)
1454
1454
  3 => 'Sony Lossless Compressed RAW', #IB
1455
+ 4 => 'Sony Lossless Compressed RAW 2', #JR (ILCE-1)
1455
1456
  },
1456
1457
  },
1457
1458
  # 0x7001 - int16u[1] (in SubIFD of Sony ARW images) - values: 0,1
@@ -1472,6 +1473,7 @@ my %opcodeInfo = (
1472
1473
  PrintConv => {
1473
1474
  256 => 'Off',
1474
1475
  257 => 'Auto',
1476
+ 272 => 'Auto (ILCE-1)', #JR
1475
1477
  511 => 'No correction params available',
1476
1478
  },
1477
1479
  },
@@ -5796,7 +5798,8 @@ sub ProcessExif($$$)
5796
5798
  $numEntries = Get16u($dataPt, $dirStart);
5797
5799
  } else {
5798
5800
  $et->Warn("Bad $dir directory", $inMakerNotes);
5799
- return 0 unless $inMakerNotes and $dirLen >= 14;
5801
+ return 0 unless $inMakerNotes and $dirLen >= 14 and $dirStart >= 0 and
5802
+ $dirStart + $dirLen <= length($$dataPt);
5800
5803
  $dirSize = $dirLen;
5801
5804
  $numEntries = int(($dirSize - 2) / 12); # read what we can
5802
5805
  Set16u($numEntries, $dataPt, $dirStart);
@@ -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
@@ -12,13 +12,12 @@ use strict;
12
12
  use vars qw($VERSION);
13
13
  use Image::ExifTool::Exif;
14
14
 
15
- $VERSION = '1.52';
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,7 +49,7 @@ 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])\b/i;
52
+ return uc $2 if $val =~ /(^|[^A-Z])([NS])(orth|outh)?\b/i;
54
53
  return $1 eq '-' ? 'S' : 'N' if $val =~ /([-+]?)\d+/;
55
54
  return undef;
56
55
  },
@@ -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,7 +78,7 @@ 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])\b/i;
81
+ return uc $2 if $val =~ /(^|[^A-Z])([EW])(ast|est)?\b/i;
82
82
  return $1 eq '-' ? 'W' : 'E' if $val =~ /([-+]?)\d+/;
83
83
  return undef;
84
84
  },
@@ -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