exiftool_vendored 12.41.0 → 12.50.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (77) hide show
  1. checksums.yaml +4 -4
  2. data/bin/Changes +209 -6
  3. data/bin/MANIFEST +12 -0
  4. data/bin/META.json +1 -1
  5. data/bin/META.yml +1 -1
  6. data/bin/README +45 -44
  7. data/bin/config_files/acdsee.config +2 -1
  8. data/bin/config_files/frameCount.config +56 -0
  9. data/bin/config_files/tiff_version.config +1 -1
  10. data/bin/exiftool +115 -96
  11. data/bin/fmt_files/gpx.fmt +3 -0
  12. data/bin/fmt_files/gpx_wpt.fmt +3 -0
  13. data/bin/lib/Image/ExifTool/Apple.pm +16 -3
  14. data/bin/lib/Image/ExifTool/BuildTagLookup.pm +23 -12
  15. data/bin/lib/Image/ExifTool/Canon.pm +71 -33
  16. data/bin/lib/Image/ExifTool/CanonRaw.pm +8 -1
  17. data/bin/lib/Image/ExifTool/CanonVRD.pm +7 -8
  18. data/bin/lib/Image/ExifTool/DJI.pm +60 -1
  19. data/bin/lib/Image/ExifTool/DNG.pm +8 -2
  20. data/bin/lib/Image/ExifTool/DarwinCore.pm +13 -1
  21. data/bin/lib/Image/ExifTool/EXE.pm +9 -1
  22. data/bin/lib/Image/ExifTool/Exif.pm +26 -12
  23. data/bin/lib/Image/ExifTool/FLAC.pm +17 -3
  24. data/bin/lib/Image/ExifTool/FLIR.pm +4 -3
  25. data/bin/lib/Image/ExifTool/FlashPix.pm +26 -3
  26. data/bin/lib/Image/ExifTool/FujiFilm.pm +51 -4
  27. data/bin/lib/Image/ExifTool/GPS.pm +21 -1
  28. data/bin/lib/Image/ExifTool/Geotag.pm +25 -5
  29. data/bin/lib/Image/ExifTool/ICC_Profile.pm +12 -9
  30. data/bin/lib/Image/ExifTool/ICO.pm +143 -0
  31. data/bin/lib/Image/ExifTool/ID3.pm +11 -11
  32. data/bin/lib/Image/ExifTool/IPTC.pm +5 -1
  33. data/bin/lib/Image/ExifTool/LNK.pm +5 -2
  34. data/bin/lib/Image/ExifTool/M2TS.pm +98 -8
  35. data/bin/lib/Image/ExifTool/MIE.pm +9 -3
  36. data/bin/lib/Image/ExifTool/MISB.pm +494 -0
  37. data/bin/lib/Image/ExifTool/MakerNotes.pm +8 -1
  38. data/bin/lib/Image/ExifTool/Matroska.pm +24 -16
  39. data/bin/lib/Image/ExifTool/Motorola.pm +8 -2
  40. data/bin/lib/Image/ExifTool/Nikon.pm +293 -122
  41. data/bin/lib/Image/ExifTool/NikonCustom.pm +4 -1
  42. data/bin/lib/Image/ExifTool/NikonSettings.pm +5 -3
  43. data/bin/lib/Image/ExifTool/Olympus.pm +22 -2
  44. data/bin/lib/Image/ExifTool/PDF.pm +2 -1
  45. data/bin/lib/Image/ExifTool/Panasonic.pm +30 -4
  46. data/bin/lib/Image/ExifTool/PanasonicRaw.pm +25 -5
  47. data/bin/lib/Image/ExifTool/Parrot.pm +96 -2
  48. data/bin/lib/Image/ExifTool/Pentax.pm +8 -3
  49. data/bin/lib/Image/ExifTool/Photoshop.pm +35 -8
  50. data/bin/lib/Image/ExifTool/QuickTime.pm +163 -13
  51. data/bin/lib/Image/ExifTool/QuickTimeStream.pl +119 -13
  52. data/bin/lib/Image/ExifTool/README +13 -3
  53. data/bin/lib/Image/ExifTool/RIFF.pm +106 -9
  54. data/bin/lib/Image/ExifTool/Samsung.pm +234 -3
  55. data/bin/lib/Image/ExifTool/Shortcuts.pm +2 -1
  56. data/bin/lib/Image/ExifTool/Sigma.pm +27 -1
  57. data/bin/lib/Image/ExifTool/SigmaRaw.pm +37 -13
  58. data/bin/lib/Image/ExifTool/Sony.pm +71 -43
  59. data/bin/lib/Image/ExifTool/TagInfoXML.pm +3 -1
  60. data/bin/lib/Image/ExifTool/TagLookup.pm +4752 -4516
  61. data/bin/lib/Image/ExifTool/TagNames.pod +1885 -1434
  62. data/bin/lib/Image/ExifTool/Text.pm +3 -4
  63. data/bin/lib/Image/ExifTool/Torrent.pm +2 -3
  64. data/bin/lib/Image/ExifTool/Validate.pm +3 -3
  65. data/bin/lib/Image/ExifTool/WriteCanonRaw.pl +7 -0
  66. data/bin/lib/Image/ExifTool/WriteExif.pl +100 -23
  67. data/bin/lib/Image/ExifTool/WriteIPTC.pl +2 -6
  68. data/bin/lib/Image/ExifTool/WritePhotoshop.pl +5 -5
  69. data/bin/lib/Image/ExifTool/WriteRIFF.pl +359 -0
  70. data/bin/lib/Image/ExifTool/Writer.pl +14 -6
  71. data/bin/lib/Image/ExifTool/XMP.pm +78 -59
  72. data/bin/lib/Image/ExifTool/XMP2.pl +19 -4
  73. data/bin/lib/Image/ExifTool.pm +120 -33
  74. data/bin/lib/Image/ExifTool.pod +83 -69
  75. data/bin/perl-Image-ExifTool.spec +43 -43
  76. data/lib/exiftool_vendored/version.rb +1 -1
  77. metadata +9 -4
@@ -538,10 +538,11 @@ my %sImageRegion = ( # new in 1.5
538
538
  NAMESPACE => 'Iptc4xmpExt',
539
539
  TABLE_DESC => 'XMP IPTC Extension',
540
540
  NOTES => q{
541
- This table contains tags defined by the IPTC Extension schema version 1.6.
542
- The actual namespace prefix is "Iptc4xmpExt", but ExifTool shortens this for
543
- the family 1 group name. (see
544
- L<http://www.iptc.org/standards/photo-metadata/iptc-standard/>)
541
+ This table contains tags defined by the IPTC Extension schema version 1.7
542
+ and IPTC Video Metadata version 1.3. The actual namespace prefix is
543
+ "Iptc4xmpExt", but ExifTool shortens this for the family 1 group name. (See
544
+ L<http://www.iptc.org/standards/photo-metadata/iptc-standard/> and
545
+ L<https://iptc.org/standards/video-metadata-hub/>.)
545
546
  },
546
547
  AboutCvTerm => {
547
548
  Struct => \%sCVTermDetails,
@@ -682,6 +683,7 @@ my %sImageRegion = ( # new in 1.5
682
683
  ProductName => { Writable => 'lang-alt' },
683
684
  ProductGTIN => { },
684
685
  ProductDescription => { Writable => 'lang-alt' },
686
+ ProductId => { }, # added in version 2022.1
685
687
  },
686
688
  List => 'Bag',
687
689
  },
@@ -796,6 +798,12 @@ my %sImageRegion = ( # new in 1.5
796
798
  },
797
799
  PlanningRef => { List => 'Bag', Struct => \%sEntityWithRole },
798
800
  audioBitsPerSample => { Groups => { 2 => 'Audio' }, Writable => 'integer' },
801
+ # new IPTC video metadata 1.3 properties
802
+ # (ref https://iptc.org/std/videometadatahub/recommendation/IPTC-VideoMetadataHub-props-Rec_1.3.html)
803
+ metadataLastEdited => { Groups => { 2 => 'Time' }, %dateTimeInfo },
804
+ metadataLastEditor => { Struct => \%sEntity },
805
+ metadataAuthority => { Struct => \%sEntity },
806
+ parentId => { Name => 'ParentID' },
799
807
  # new IPTC Extension schema 1.5 property
800
808
  ImageRegion => { Groups => { 2 => 'Image' }, List => 'Bag', Struct => \%sImageRegion },
801
809
  # new Extension 1.6 property
@@ -1518,6 +1526,7 @@ my %sSubVersion = (
1518
1526
  ImageHistory => { Avoid => 1, Notes => 'different format from EXIF:ImageHistory' },
1519
1527
  LensCorrectionSettings => { },
1520
1528
  ImageUniqueID => { Avoid => 1 },
1529
+ picasawebGPhotoId => { }, #forum14108
1521
1530
  );
1522
1531
 
1523
1532
  # SWF namespace tags (ref PH)
@@ -1847,6 +1856,11 @@ my %sSubVersion = (
1847
1856
  MicroVideoVersion => { Writable => 'integer' },
1848
1857
  MicroVideoOffset => { Writable => 'integer' },
1849
1858
  MicroVideoPresentationTimestampUs => { Writable => 'integer' },
1859
+ shot_log_data => { #forum14108
1860
+ Name => 'ShotLogData',
1861
+ ValueConv => 'Image::ExifTool::XMP::DecodeBase64($val)',
1862
+ ValueConvInv => 'Image::ExifTool::XMP::EncodeBase64($val)',
1863
+ },
1850
1864
  );
1851
1865
 
1852
1866
  # Google creations namespace (ref PH)
@@ -1856,6 +1870,7 @@ my %sSubVersion = (
1856
1870
  NAMESPACE => 'GCreations',
1857
1871
  NOTES => 'Google creations tags.',
1858
1872
  CameraBurstID => { },
1873
+ Type => { Avoid => 1 },
1859
1874
  );
1860
1875
 
1861
1876
  # Google depth-map Device namespace (ref 13)
@@ -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.41';
32
+ $VERSION = '12.50';
33
33
  $RELEASE = '';
34
34
  @ISA = qw(Exporter);
35
35
  %EXPORT_TAGS = (
@@ -139,8 +139,8 @@ sub ReadValue($$$;$$$);
139
139
  @loadAllTables = qw(
140
140
  PhotoMechanic Exif GeoTiff CanonRaw KyoceraRaw Lytro MinoltaRaw PanasonicRaw
141
141
  SigmaRaw JPEG GIMP Jpeg2000 GIF BMP BMP::OS2 BMP::Extra BPG BPG::Extensions
142
- PICT PNG MNG FLIF DjVu DPX OpenEXR ZISRAW MRC LIF MRC::FEI12 MIFF PCX PGF
143
- PSP PhotoCD Radiance Other::PFM PDF PostScript Photoshop::Header
142
+ ICO PICT PNG MNG FLIF DjVu DPX OpenEXR ZISRAW MRC LIF MRC::FEI12 MIFF PCX
143
+ PGF PSP PhotoCD Radiance Other::PFM PDF PostScript Photoshop::Header
144
144
  Photoshop::Layers Photoshop::ImageData FujiFilm::RAF FujiFilm::IFD
145
145
  Samsung::Trailer Sony::SRF2 Sony::SR2SubIFD Sony::PMP ITC ID3 ID3::Lyrics3
146
146
  FLAC Ogg Vorbis APE APE::NewHeader APE::OldHeader Audible MPC MPEG::Audio
@@ -191,11 +191,12 @@ $defaultLang = 'en'; # default language
191
191
  HTML VRD RTF FITS XCF DSS QTIF FPX PICT ZIP GZIP PLIST RAR BZ2
192
192
  CZI TAR EXE EXR HDR CHM LNK WMF AVC DEX DPX RAW Font RSRC M2TS
193
193
  MacOS PHP PCX DCX DWF DWG DXF WTV Torrent VCard LRI R3D AA PDB
194
- PFM2 MRC LIF JXL MOI ISO ALIAS JSON MP3 DICOM PCD TXT);
194
+ PFM2 MRC LIF JXL MOI ISO ALIAS JSON MP3 DICOM PCD ICO TXT);
195
195
 
196
196
  # file types that we can write (edit)
197
197
  my @writeTypes = qw(JPEG TIFF GIF CRW MRW ORF RAF RAW PNG MIE PSD XMP PPM EPS
198
- X3F PS PDF ICC VRD DR4 JP2 JXL EXIF AI AIT IND MOV EXV FLIF);
198
+ X3F PS PDF ICC VRD DR4 JP2 JXL EXIF AI AIT IND MOV EXV FLIF
199
+ RIFF);
199
200
  my %writeTypes; # lookup for writable file types (hash filled if required)
200
201
 
201
202
  # file extensions that we can't write for various base types
@@ -205,6 +206,8 @@ my %writeTypes; # lookup for writable file types (hash filled if required)
205
206
  JP2 => [ qw(J2C JPC) ],
206
207
  MOV => [ qw(INSV) ],
207
208
  );
209
+ # file extensions that we can only write for various base types
210
+ my %onlyWriteFile = ( RIFF => [ qw(WEBP) ] );
208
211
 
209
212
  # file types that we can create from scratch
210
213
  # - must update CanCreate() documentation if this list is changed!
@@ -257,6 +260,7 @@ my %createTypes = map { $_ => 1 } qw(XMP ICC MIE VRD DR4 EXIF EXV);
257
260
  CRW => ['CRW', 'Canon RAW format'],
258
261
  CS1 => ['PSD', 'Sinar CaptureShop 1-Shot RAW'],
259
262
  CSV => ['TXT', 'Comma-Separated Values'],
263
+ CUR => ['ICO', 'Windows Cursor'],
260
264
  CZI => ['CZI', 'Zeiss Integrated Software RAW'],
261
265
  DC3 => 'DICM',
262
266
  DCM => 'DICM',
@@ -333,6 +337,7 @@ my %createTypes = map { $_ => 1 } qw(XMP ICC MIE VRD DR4 EXIF EXV);
333
337
  ICAL => 'ICS',
334
338
  ICC => ['ICC', 'International Color Consortium'],
335
339
  ICM => 'ICC',
340
+ ICO => ['ICO', 'Windows Icon'],
336
341
  ICS => ['VCard','iCalendar Schedule'],
337
342
  IDML => ['ZIP', 'Adobe InDesign Markup Language'],
338
343
  IIQ => ['TIFF', 'Phase One Intelligent Image Quality RAW'],
@@ -378,6 +383,7 @@ my %createTypes = map { $_ => 1 } qw(XMP ICC MIE VRD DR4 EXIF EXV);
378
383
  M4B => ['MOV', 'MPEG-4 audio Book'],
379
384
  M4P => ['MOV', 'MPEG-4 Protected'],
380
385
  M4V => ['MOV', 'MPEG-4 Video'],
386
+ MACOS=> ['MacOS','MacOS ._ sidecar file'],
381
387
  MAX => ['FPX', '3D Studio MAX'],
382
388
  MEF => ['TIFF', 'Mamiya (RAW) Electronic Format'],
383
389
  MIE => ['MIE', 'Meta Information Encapsulation format'],
@@ -407,7 +413,6 @@ my %createTypes = map { $_ => 1 } qw(XMP ICC MIE VRD DR4 EXIF EXV);
407
413
  NEF => ['TIFF', 'Nikon (RAW) Electronic Format'],
408
414
  NEWER => 'COS',
409
415
  NKSC => ['XMP', 'Nikon Sidecar'],
410
-
411
416
  NMBTEMPLATE => ['ZIP','Apple Numbers Template'],
412
417
  NRW => ['TIFF', 'Nikon RAW (2)'],
413
418
  NUMBERS => ['ZIP','Apple Numbers spreadsheet'],
@@ -530,7 +535,6 @@ my %createTypes = map { $_ => 1 } qw(XMP ICC MIE VRD DR4 EXIF EXV);
530
535
  WMV => ['ASF', 'Windows Media Video'],
531
536
  WV => ['RIFF', 'WavePack lossless audio'],
532
537
  X3F => ['X3F', 'Sigma RAW format'],
533
- MACOS=> ['MacOS','MacOS ._ sidecar file'],
534
538
  XCF => ['XCF', 'GIMP native image format'],
535
539
  XHTML=> ['HTML', 'Extensible HyperText Markup Language'],
536
540
  XLA => ['FPX', 'Microsoft Excel Add-in'],
@@ -599,6 +603,7 @@ my %fileDescription = (
599
603
  CRM => 'video/x-canon-crm',
600
604
  CRW => 'image/x-canon-crw',
601
605
  CSV => 'text/csv',
606
+ CUR => 'image/x-cursor', #PH (NC)
602
607
  CZI => 'image/x-zeiss-czi', #PH (NC)
603
608
  DCP => 'application/octet-stream', #PH (NC)
604
609
  DCR => 'image/x-kodak-dcr',
@@ -647,6 +652,7 @@ my %fileDescription = (
647
652
  HDR => 'image/vnd.radiance',
648
653
  HTML => 'text/html',
649
654
  ICC => 'application/vnd.iccprofile',
655
+ ICO => 'image/x-icon', #PH (NC)
650
656
  ICS => 'text/calendar',
651
657
  IDML => 'application/vnd.adobe.indesign-idml-package',
652
658
  IIQ => 'image/x-raw',
@@ -913,6 +919,7 @@ $testLen = 1024; # number of bytes to read when testing for magic number
913
919
  HDR => '#\?(RADIANCE|RGBE)\x0a',
914
920
  HTML => '(\xef\xbb\xbf)?\s*(?i)<(!DOCTYPE\s+HTML|HTML|\?xml)', # (case insensitive)
915
921
  ICC => '.{12}(scnr|mntr|prtr|link|spac|abst|nmcl|nkpf|cenc|mid |mlnk|mvis)(XYZ |Lab |Luv |YCbr|Yxy |RGB |GRAY|HSV |HLS |CMYK|CMY |[2-9A-F]CLR|nc..|\0{4}){2}',
922
+ ICO => '\0\0[\x01\x02]\0[^0]\0', # (reasonably assume that the file contains less than 256 images)
916
923
  IND => '\x06\x06\xed\xf5\xd8\x1d\x46\xe5\xbd\x31\xef\xe7\xfe\x74\xb7\x1d',
917
924
  # ISO => signature is at byte 32768
918
925
  ITC => '.{4}itch',
@@ -925,6 +932,7 @@ $testLen = 1024; # number of bytes to read when testing for magic number
925
932
  LNK => '.{4}\x01\x14\x02\0{5}\xc0\0{6}\x46',
926
933
  LRI => 'LELR \0',
927
934
  M2TS => '(....)?\x47',
935
+ MacOS=> '\0\x05\x16\x07\0.\0\0Mac OS X ',
928
936
  MIE => '~[\x10\x18]\x04.0MIE',
929
937
  MIFF => 'id=ImageMagick',
930
938
  MKV => '\x1a\x45\xdf\xa3',
@@ -972,7 +980,6 @@ $testLen = 1024; # number of bytes to read when testing for magic number
972
980
  WMF => '(\xd7\xcd\xc6\x9a\0\0|\x01\0\x09\0\0\x03)',
973
981
  WTV => '\xb7\xd8\x00\x20\x37\x49\xda\x11\xa6\x4e\x00\x07\xe9\x5e\xad\x8d',
974
982
  X3F => 'FOVb',
975
- MacOS=> '\0\x05\x16\x07\0.\0\0Mac OS X ',
976
983
  XCF => 'gimp xcf ',
977
984
  XMP => '\0{0,3}(\xfe\xff|\xff\xfe|\xef\xbb\xbf)?\0{0,3}\s*<',
978
985
  ZIP => 'PK\x03\x04',
@@ -2209,6 +2216,20 @@ sub Options($$;@)
2209
2216
  } else {
2210
2217
  $$options{$param} = undef; # clear the list
2211
2218
  }
2219
+ } elsif ($param eq 'IgnoreTags') {
2220
+ if (defined $newVal) {
2221
+ # parse list from delimited string if necessary
2222
+ my @ignoreList = (ref $newVal eq 'ARRAY') ? @$newVal : ($newVal =~ /[-\w?*:]+/g);
2223
+ ExpandShortcuts(\@ignoreList);
2224
+ # add to existing tags to ignore
2225
+ $$options{$param} or $$options{$param} = { };
2226
+ foreach (@ignoreList) {
2227
+ /^(.*:)?([-\w?*]+)#?$/ or next;
2228
+ $$options{$param}{lc $2} = 1;
2229
+ }
2230
+ } else {
2231
+ $$options{$param} = undef; # clear the option
2232
+ }
2212
2233
  } elsif ($param eq 'ListJoin') {
2213
2234
  $$options{$param} = $newVal;
2214
2235
  # set the old List and ListSep options for backward compatibility
@@ -2321,6 +2342,7 @@ sub ClearOptions($)
2321
2342
  HtmlDump => 0, # HTML dump (0-3, higher # = bigger limit)
2322
2343
  HtmlDumpBase => undef, # base address for HTML dump
2323
2344
  IgnoreMinorErrors => undef, # ignore minor errors when reading/writing
2345
+ IgnoreTags => undef, # list of tags to ignore when extracting
2324
2346
  Lang => $defaultLang,# localized language for descriptions etc
2325
2347
  LargeFileSupport => undef, # flag indicating support of 64-bit file offsets
2326
2348
  List => undef, # extract lists of PrintConv values into arrays [no longer documented]
@@ -3860,6 +3882,10 @@ sub CanWrite($)
3860
3882
  my $ext = GetFileExtension($file) || uc($file);
3861
3883
  return grep(/^$ext$/, @{$noWriteFile{$type}}) ? 0 : 1 if $ext;
3862
3884
  }
3885
+ if ($onlyWriteFile{$type}) {
3886
+ my $ext = GetFileExtension($file) || uc($file);
3887
+ return grep(/^$ext$/, @{$onlyWriteFile{$type}}) ? 1 : 0 if $ext;
3888
+ }
3863
3889
  unless (%writeTypes) {
3864
3890
  $writeTypes{$_} = 1 foreach @writeTypes;
3865
3891
  }
@@ -4027,6 +4053,57 @@ sub NextTagKey($$)
4027
4053
  return undef;
4028
4054
  }
4029
4055
 
4056
+ #------------------------------------------------------------------------------
4057
+ # Does a string contain valid UTF-8 characters?
4058
+ # Inputs: 0) string reference, 1) true to allow last character to be truncated
4059
+ # Returns: 0=regular ASCII, -1=invalid UTF-8, 1=valid UTF-8 with maximum 16-bit
4060
+ # wide characters, 2=valid UTF-8 requiring 32-bit wide characters
4061
+ # Notes: Changes current string position
4062
+ # (see http://www.fileformat.info/info/unicode/utf8.htm for help understanding this)
4063
+ sub IsUTF8($;$)
4064
+ {
4065
+ my ($strPt, $trunc) = @_;
4066
+ pos($$strPt) = 0; # start at beginning of string
4067
+ return 0 unless $$strPt =~ /([\x80-\xff])/g;
4068
+ my $rtnVal = 1;
4069
+ for (;;) {
4070
+ my $ch = ord($1);
4071
+ # minimum lead byte for 2-byte sequence is 0xc2 (overlong sequences
4072
+ # not allowed), 0xf8-0xfd are restricted by RFC 3629 (no 5 or 6 byte
4073
+ # sequences), and 0xfe and 0xff are not valid in UTF-8 strings
4074
+ return -1 if $ch < 0xc2 or $ch >= 0xf8;
4075
+ # determine number of bytes remaining in sequence
4076
+ my $n;
4077
+ if ($ch < 0xe0) {
4078
+ $n = 1;
4079
+ } elsif ($ch < 0xf0) {
4080
+ $n = 2;
4081
+ } else {
4082
+ $n = 3;
4083
+ # character code is greater than 0xffff if more than 2 extra bytes
4084
+ # were required in the UTF-8 character
4085
+ $rtnVal = 2;
4086
+ }
4087
+ my $pos = pos $$strPt;
4088
+ unless ($$strPt =~ /\G([\x80-\xbf]{$n})/g) {
4089
+ return $rtnVal if $trunc and $pos + $n > length $$strPt;
4090
+ return -1;
4091
+ }
4092
+ # the following is ref https://www.cl.cam.ac.uk/%7Emgk25/ucs/utf8_check.c
4093
+ if ($n == 2) {
4094
+ return -1 if ($ch == 0xe0 and (ord($1) & 0xe0) == 0x80) or
4095
+ ($ch == 0xed and (ord($1) & 0xe0) == 0xa0) or
4096
+ ($ch == 0xef and ord($1) == 0xbf and
4097
+ (ord(substr $1, 1) & 0xfe) == 0xbe);
4098
+ } else {
4099
+ return -1 if ($ch == 0xf0 and (ord($1) & 0xf0) == 0x80) or
4100
+ ($ch == 0xf4 and ord($1) > 0x8f) or $ch > 0xf4;
4101
+ }
4102
+ last unless $$strPt =~ /([\x80-\xff])/g;
4103
+ }
4104
+ return $rtnVal;
4105
+ }
4106
+
4030
4107
  #------------------------------------------------------------------------------
4031
4108
  # Split file name into directory and name parts
4032
4109
  # Inptus: 0) file name
@@ -4072,10 +4149,7 @@ sub EncodeFileName($$;$)
4072
4149
  }
4073
4150
  }
4074
4151
  } elsif ($^O eq 'MSWin32' and $file =~ /[\x80-\xff]/ and not defined $enc) {
4075
- require Image::ExifTool::XMP;
4076
- if (Image::ExifTool::XMP::IsUTF8(\$file) < 0) {
4077
- $self->WarnOnce('FileName encoding not specified');
4078
- }
4152
+ $self->WarnOnce('FileName encoding not specified') if IsUTF8(\$file) < 0;
4079
4153
  }
4080
4154
  return 0;
4081
4155
  }
@@ -5689,8 +5763,8 @@ sub ConvertDateTime($$)
5689
5763
  $a[4] -= 1; # base month is 1
5690
5764
  # parse our %f fractional seconds first (and round up seconds if necessary)
5691
5765
  # - if there are multiple %f codes, they all get the same number of digits as the first
5692
- if ($fmt =~ /%\.?(\d*)f/) {
5693
- my $dig = $1;
5766
+ if ($fmt =~ /%(-?)\.?(\d*)f/) {
5767
+ my ($neg, $dig) = ($1, $2);
5694
5768
  my $frac = $date =~ /(\.\d+)/ ? $1 : '';
5695
5769
  if (not $frac) {
5696
5770
  $frac = '.' . ('0' x $dig) if $dig;
@@ -5717,7 +5791,8 @@ sub ConvertDateTime($$)
5717
5791
  }
5718
5792
  }
5719
5793
  }
5720
- $fmt =~ s/(^|[^%])((%%)*)%\.?\d*f/$1$2$frac/g;
5794
+ $neg and $frac =~ s/^\.//;
5795
+ $fmt =~ s/(^|[^%])((%%)*)%-?\.?\d*f/$1$2$frac/g;
5721
5796
  }
5722
5797
  # parse %z and %s ourself (to handle time zones properly)
5723
5798
  if ($fmt =~ /%[sz]/) {
@@ -5863,7 +5938,7 @@ sub GetUnixTime($;$)
5863
5938
  {
5864
5939
  my ($timeStr, $isLocal) = @_;
5865
5940
  return 0 if $timeStr eq '0000:00:00 00:00:00';
5866
- my @tm = ($timeStr =~ /^(\d+):(\d+):(\d+)\s+(\d+):(\d+):(\d+)(.*)/);
5941
+ my @tm = ($timeStr =~ /^(\d+)[-:](\d+)[-:](\d+)\s+(\d+):(\d+):(\d+)(.*)/);
5867
5942
  return undef unless @tm == 7;
5868
5943
  unless (eval { require Time::Local }) {
5869
5944
  warn "Time::Local is not installed\n";
@@ -5896,13 +5971,13 @@ sub GetUnixTime($;$)
5896
5971
  sub ConvertFileSize($)
5897
5972
  {
5898
5973
  my $val = shift;
5899
- $val < 2048 and return "$val bytes";
5900
- $val < 10240 and return sprintf('%.1f KiB', $val / 1024);
5901
- $val < 2097152 and return sprintf('%.0f KiB', $val / 1024);
5902
- $val < 10485760 and return sprintf('%.1f MiB', $val / 1048576);
5903
- $val < 2147483648 and return sprintf('%.0f MiB', $val / 1048576);
5904
- $val < 10737418240 and return sprintf('%.1f GiB', $val / 1073741824);
5905
- return sprintf('%.0f GiB', $val / 1073741824);
5974
+ $val < 2000 and return "$val bytes";
5975
+ $val < 10000 and return sprintf('%.1f kB', $val / 1000);
5976
+ $val < 2000000 and return sprintf('%.0f kB', $val / 1000);
5977
+ $val < 10000000 and return sprintf('%.1f MB', $val / 1000000);
5978
+ $val < 2000000000 and return sprintf('%.0f MB', $val / 1000000);
5979
+ $val < 10000000000 and return sprintf('%.1f GB', $val / 1000000000);
5980
+ return sprintf('%.0f GB', $val / 1000000000);
5906
5981
  }
5907
5982
 
5908
5983
  #------------------------------------------------------------------------------
@@ -7686,8 +7761,8 @@ sub DoProcessTIFF($$;$)
7686
7761
  # check DNG version
7687
7762
  if ($$self{DNGVersion}) {
7688
7763
  my $ver = $$self{DNGVersion};
7689
- # currently support up to DNG version 1.5
7690
- unless ($ver =~ /^(\d+) (\d+)/ and "$1.$2" <= 1.5) {
7764
+ # currently support up to DNG version 1.6
7765
+ unless ($ver =~ /^(\d+) (\d+)/ and "$1.$2" <= 1.6) {
7691
7766
  $ver =~ tr/ /./;
7692
7767
  $self->Error("DNG Version $ver not yet tested", 1);
7693
7768
  }
@@ -7955,11 +8030,11 @@ sub GetTagInfo($$$;$$$)
7955
8030
  next;
7956
8031
  }
7957
8032
  }
7958
- if ($$tagInfo{Unknown} and not $$self{OPTIONS}{Unknown} and
7959
- not $$self{OPTIONS}{Verbose} and not $$self{OPTIONS}{Validate} and
7960
- not $$self{HTML_DUMP})
8033
+ # don't return Unknown tags unless that option is set (also see forum13716)
8034
+ if ($$tagInfo{Unknown} and not $$self{OPTIONS}{Unknown} and not
8035
+ ($$self{OPTIONS}{Verbose} or $$self{HTML_DUMP} or
8036
+ ($$self{OPTIONS}{Validate} and not $$tagInfo{AddedUnknown})))
7961
8037
  {
7962
- # don't return Unknown tags unless that option is set
7963
8038
  return undef;
7964
8039
  }
7965
8040
  # return the tag information we found
@@ -7984,6 +8059,7 @@ sub GetTagInfo($$$;$$$)
7984
8059
  Unknown => 1,
7985
8060
  Writable => 0, # can't write unknown tags
7986
8061
  PrintConv => $printConv,
8062
+ AddedUnknown => 1,
7987
8063
  };
7988
8064
  # add tag information to table
7989
8065
  AddTagToTable($tagTablePtr, $tagID, $tagInfo);
@@ -8045,6 +8121,7 @@ sub AddTagToTable($$;$$)
8045
8121
  unless (defined $$tagTablePtr{$tagID} or $specialTags{$tagID}) {
8046
8122
  $$tagTablePtr{$tagID} = $tagInfo;
8047
8123
  }
8124
+ $$tagInfo{AddedUnknown} = 1 if $$tagInfo{Unknown};
8048
8125
  return $tagInfo;
8049
8126
  }
8050
8127
 
@@ -8187,15 +8264,17 @@ sub FoundTag($$$;@)
8187
8264
  {
8188
8265
  local $_;
8189
8266
  my ($self, $tagInfo, $value, @grps) = @_;
8190
- my ($tag, $noListDel);
8267
+ my ($tag, $noListDel, $tbl);
8191
8268
  my $options = $$self{OPTIONS};
8192
8269
 
8193
8270
  if (ref $tagInfo eq 'HASH') {
8194
8271
  $tag = $$tagInfo{Name} or warn("No tag name\n"), return undef;
8272
+ $tbl = $$tagInfo{Table};
8195
8273
  } else {
8196
8274
  $tag = $tagInfo;
8197
8275
  # look for tag in Extra
8198
- $tagInfo = $self->GetTagInfo(GetTagTable('Image::ExifTool::Extra'), $tag);
8276
+ $tbl = GetTagTable('Image::ExifTool::Extra');
8277
+ $tagInfo = $self->GetTagInfo($tbl, $tag);
8199
8278
  # make temporary hash if tag doesn't exist in Extra
8200
8279
  # (not advised to do this since the tag won't show in list)
8201
8280
  $tagInfo or $tagInfo = { Name => $tag, Groups => \%allGroupsExifTool };
@@ -8204,7 +8283,7 @@ sub FoundTag($$$;@)
8204
8283
  # get tag priority
8205
8284
  my $priority = $$tagInfo{Priority};
8206
8285
  unless (defined $priority) {
8207
- $priority = $$tagInfo{Table}{PRIORITY};
8286
+ $priority = $$tbl{PRIORITY};
8208
8287
  $priority = 0 if not defined $priority and $$tagInfo{Avoid};
8209
8288
  }
8210
8289
  $grps[0] or $grps[0] = $$self{SET_GROUP0};
@@ -8233,6 +8312,14 @@ sub FoundTag($$$;@)
8233
8312
  $self->Warn("RawConv $tag: " . CleanWarning()) if $evalWarning;
8234
8313
  return undef unless defined $value;
8235
8314
  }
8315
+ # ignore specified tags (AFTER doing RawConv if necessary!)
8316
+ if ($$options{IgnoreTags}) {
8317
+ if ($$options{IgnoreTags}{all}) {
8318
+ return undef unless $$self{REQ_TAG_LOOKUP}{lc $tag};
8319
+ } else {
8320
+ return undef if $$options{IgnoreTags}{lc $tag};
8321
+ }
8322
+ }
8236
8323
  # handle duplicate tag names
8237
8324
  if (defined $$valueHash{$tag}) {
8238
8325
  # add to list if there is an active list for this tag
@@ -8444,7 +8531,7 @@ sub SetFileType($;$$$)
8444
8531
 
8445
8532
  #------------------------------------------------------------------------------
8446
8533
  # Override the FileType and MIMEType tags
8447
- # Inputs: 0) ExifTool object ref, 1) file type, 2) MIME type, 3) normal extension
8534
+ # Inputs: 0) ExifTool object ref, 1) file type, 2) MIME type, 3) normal extension (lower case)
8448
8535
  # Notes: does nothing if FileType was not previously defined (ie. when writing)
8449
8536
  sub OverrideFileType($$;$$)
8450
8537
  {