exiftool_vendored 12.33.0 → 12.37.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 (38) hide show
  1. checksums.yaml +4 -4
  2. data/bin/Changes +66 -0
  3. data/bin/META.json +1 -1
  4. data/bin/META.yml +1 -1
  5. data/bin/README +2 -2
  6. data/bin/exiftool +65 -37
  7. data/bin/lib/Image/ExifTool/BuildTagLookup.pm +11 -2
  8. data/bin/lib/Image/ExifTool/Canon.pm +156 -10
  9. data/bin/lib/Image/ExifTool/Charset.pm +2 -0
  10. data/bin/lib/Image/ExifTool/DarwinCore.pm +2 -2
  11. data/bin/lib/Image/ExifTool/Exif.pm +13 -1
  12. data/bin/lib/Image/ExifTool/FLIR.pm +33 -8
  13. data/bin/lib/Image/ExifTool/GIF.pm +5 -1
  14. data/bin/lib/Image/ExifTool/GPS.pm +14 -10
  15. data/bin/lib/Image/ExifTool/ICC_Profile.pm +96 -4
  16. data/bin/lib/Image/ExifTool/Jpeg2000.pm +108 -11
  17. data/bin/lib/Image/ExifTool/Nikon.pm +992 -18
  18. data/bin/lib/Image/ExifTool/NikonCustom.pm +5 -1
  19. data/bin/lib/Image/ExifTool/NikonSettings.pm +135 -71
  20. data/bin/lib/Image/ExifTool/PDF.pm +5 -3
  21. data/bin/lib/Image/ExifTool/PNG.pm +1 -0
  22. data/bin/lib/Image/ExifTool/QuickTime.pm +17 -3
  23. data/bin/lib/Image/ExifTool/QuickTimeStream.pl +26 -1
  24. data/bin/lib/Image/ExifTool/README +4 -0
  25. data/bin/lib/Image/ExifTool/Sony.pm +29 -11
  26. data/bin/lib/Image/ExifTool/TagInfoXML.pm +9 -4
  27. data/bin/lib/Image/ExifTool/TagLookup.pm +6437 -5843
  28. data/bin/lib/Image/ExifTool/TagNames.pod +1292 -46
  29. data/bin/lib/Image/ExifTool/WriteQuickTime.pl +10 -0
  30. data/bin/lib/Image/ExifTool/WriteXMP.pl +10 -11
  31. data/bin/lib/Image/ExifTool/Writer.pl +50 -5
  32. data/bin/lib/Image/ExifTool/XMP.pm +119 -30
  33. data/bin/lib/Image/ExifTool/XMP2.pl +3 -2
  34. data/bin/lib/Image/ExifTool.pm +71 -8
  35. data/bin/lib/Image/ExifTool.pod +9 -1
  36. data/bin/perl-Image-ExifTool.spec +1 -1
  37. data/lib/exiftool_vendored/version.rb +1 -1
  38. metadata +2 -2
@@ -11,6 +11,7 @@
11
11
  # 4) http://www.color.org/privatetag2007-01.pdf
12
12
  # 5) http://www.color.org/icc_specs2.xalter (approved revisions, 2010-07-16)
13
13
  # 6) Eef Vreeland private communication
14
+ # 7) https://color.org/specification/ICC.2-2019.pdf
14
15
  #
15
16
  # Notes: The ICC profile information is different: the format of each
16
17
  # tag is embedded in the information instead of in the directory
@@ -24,7 +25,7 @@ use strict;
24
25
  use vars qw($VERSION);
25
26
  use Image::ExifTool qw(:DataAccess :Utils);
26
27
 
27
- $VERSION = '1.36';
28
+ $VERSION = '1.38';
28
29
 
29
30
  sub ProcessICC($$);
30
31
  sub ProcessICC_Profile($$$);
@@ -52,6 +53,11 @@ my %profileClass = (
52
53
  abst => 'Abstract Profile',
53
54
  nmcl => 'NamedColor Profile',
54
55
  nkpf => 'Nikon Input Device Profile (NON-STANDARD!)', # (written by Nikon utilities)
56
+ # additions in v5 (ref 7)
57
+ cenc => 'ColorEncodingSpace Profile',
58
+ 'mid '=> 'MultiplexIdentification Profile',
59
+ mlnk => 'MultiplexLink Profile',
60
+ mvis => 'MultiplexVisualization Profile',
55
61
  );
56
62
  my %manuSig = ( #6
57
63
  'NONE' => 'none',
@@ -539,6 +545,90 @@ my %manuSig = ( #6
539
545
  Binary => 1, # (NC)
540
546
  },
541
547
 
548
+ # new tags in v5 (ref 7)
549
+ A2B3 => 'AToB3',
550
+ A2M0 => 'AToM0',
551
+ B2A3 => 'BToA3',
552
+ bcp0 => 'BRDFColorimetricParam0',
553
+ bcp1 => 'BRDFColorimetricParam1',
554
+ bcp2 => 'BRDFColorimetricParam2',
555
+ bcp3 => 'BRDFColorimetricParam3',
556
+ bsp0 => 'BRDFSpectralParam0',
557
+ bsp1 => 'BRDFSpectralParam1',
558
+ bsp2 => 'BRDFSpectralParam2',
559
+ bsp3 => 'BRDFSpectralParam3',
560
+ bAB0 => 'BRDFAToB0',
561
+ bAB1 => 'BRDFAToB1',
562
+ bAB2 => 'BRDFAToB2',
563
+ bAB3 => 'BRDFAToB3',
564
+ bBA0 => 'BRDFBToA0',
565
+ bBA1 => 'BRDFBToA1',
566
+ bBA2 => 'BRDFBToA2',
567
+ bBA3 => 'BRDFBToA3',
568
+ bBD0 => 'BRDFBToD0',
569
+ bBD1 => 'BRDFBToD1',
570
+ bBD2 => 'BRDFBToD2',
571
+ bBD3 => 'BRDFBToD3',
572
+ bDB0 => 'BRDFDToB0',
573
+ bDB1 => 'BRDFDToB1',
574
+ bDB2 => 'BRDFDToB2',
575
+ bDB3 => 'BRDFDToB3',
576
+ bMB0 => 'BRDFMToB0',
577
+ bMB1 => 'BRDFMToB1',
578
+ bMB2 => 'BRDFMToB2',
579
+ bMB3 => 'BRDFMToB3',
580
+ bMS0 => 'BRDFMToS0',
581
+ bMS1 => 'BRDFMToS1',
582
+ bMS2 => 'BRDFMToS2',
583
+ bMS3 => 'BRDFMToS3',
584
+ dAB0 => 'DirectionalAToB0',
585
+ dAB1 => 'DirectionalAToB1',
586
+ dAB2 => 'DirectionalAToB2',
587
+ dAB3 => 'DirectionalAToB3',
588
+ dBA0 => 'DirectionalBToA0',
589
+ dBA1 => 'DirectionalBToA1',
590
+ dBA2 => 'DirectionalBToA2',
591
+ dBA3 => 'DirectionalBToA3',
592
+ dBD0 => 'DirectionalBToD0',
593
+ dBD1 => 'DirectionalBToD1',
594
+ dBD2 => 'DirectionalBToD2',
595
+ dBD3 => 'DirectionalBToD3',
596
+ dDB0 => 'DirectionalDToB0',
597
+ dDB1 => 'DirectionalDToB1',
598
+ dDB2 => 'DirectionalDToB2',
599
+ dDB3 => 'DirectionalDToB3',
600
+ gdb0 => 'GamutBoundaryDescription0',
601
+ gdb1 => 'GamutBoundaryDescription1',
602
+ gdb2 => 'GamutBoundaryDescription2',
603
+ gdb3 => 'GamutBoundaryDescription3',
604
+ 'mdv '=> 'MultiplexDefaultValues',
605
+ mcta => 'MultiplexTypeArray',
606
+ minf => 'MeasurementInfo',
607
+ miin => 'MeasurementInputInfo',
608
+ M2A0 => 'MToA0',
609
+ M2B0 => 'MToB0',
610
+ M2B1 => 'MToB1',
611
+ M2B2 => 'MToB2',
612
+ M2B3 => 'MToB3',
613
+ M2S0 => 'MToS0',
614
+ M2S1 => 'MToS1',
615
+ M2S2 => 'MToS2',
616
+ M2S3 => 'MToS3',
617
+ cept => 'ColorEncodingParams',
618
+ csnm => 'ColorSpaceName',
619
+ cloo => 'ColorantOrderOut',
620
+ clio => 'ColorantInfoOut',
621
+ c2sp => 'CustomToStandardPcc',
622
+ 'CxF '=> 'CXF',
623
+ nmcl => 'NamedColor',
624
+ psin => 'ProfileSequenceInfo',
625
+ rfnm => 'ReferenceName',
626
+ svcn => 'SpectralViewingConditions',
627
+ swpt => 'SpectralWhitePoint',
628
+ s2cp => 'StandardToCustomPcc',
629
+ smap => 'SurfaceMap',
630
+ # smwp ? (seen in some v5 samples)
631
+
542
632
  # the following entry represents the ICC profile header, and doesn't
543
633
  # exist as a tag in the directory. It is only in this table to provide
544
634
  # a link so ExifTool can locate the header tags
@@ -850,7 +940,7 @@ sub FormatICCTag($$$)
850
940
  # dataType
851
941
  if ($type eq 'data' and $size >= 12) {
852
942
  my $form = Get32u($dataPt, $offset+8);
853
- # format 0 is ASCII data
943
+ # format 0 is UTF-8 data
854
944
  $form == 0 and return substr($$dataPt, $offset+12, $size-12);
855
945
  # binary data and other data types treat as binary (ie. don't format)
856
946
  }
@@ -1022,7 +1112,7 @@ sub ValidateICC($)
1022
1112
  $profileClass{substr($$valPtr, 12, 4)} or $err = 'profile class';
1023
1113
  my $col = substr($$valPtr, 16, 4); # ColorSpaceData
1024
1114
  my $con = substr($$valPtr, 20, 4); # ConnectionSpace
1025
- my $match = '(XYZ |Lab |Luv |YCbr|Yxy |RGB |GRAY|HSV |HLS |CMYK|CMY |[2-9A-F]CLR)';
1115
+ my $match = '(XYZ |Lab |Luv |YCbr|Yxy |RGB |GRAY|HSV |HLS |CMYK|CMY |[2-9A-F]CLR|nc..|\0{4})';
1026
1116
  $col =~ /$match/ or $err = 'color space';
1027
1117
  $con =~ /$match/ or $err = 'connection space';
1028
1118
  return $err ? "Invalid ICC profile (bad $err)" : undef;
@@ -1134,7 +1224,7 @@ sub ProcessICC_Profile($$$)
1134
1224
  my $tagInfo = $et->GetTagInfo($tagTablePtr, $tagID);
1135
1225
  # unknown tags aren't generated automatically by GetTagInfo()
1136
1226
  # if the tagID's aren't numeric, so we must do this manually:
1137
- if (not $tagInfo and $$et{OPTIONS}{Unknown}) {
1227
+ if (not $tagInfo and ($$et{OPTIONS}{Unknown} or $verbose)) {
1138
1228
  $tagInfo = { Unknown => 1 };
1139
1229
  AddTagToTable($tagTablePtr, $tagID, $tagInfo);
1140
1230
  }
@@ -1277,6 +1367,8 @@ under the same terms as Perl itself.
1277
1367
 
1278
1368
  =item L<http://developer.apple.com/documentation/GraphicsImaging/Reference/ColorSync_Manager/ColorSync_Manager.pdf>
1279
1369
 
1370
+ =item L<https://color.org/specification/ICC.2-2019.pdf>
1371
+
1280
1372
  =back
1281
1373
 
1282
1374
  =head1 SEE ALSO
@@ -16,7 +16,7 @@ use strict;
16
16
  use vars qw($VERSION);
17
17
  use Image::ExifTool qw(:DataAccess :Utils);
18
18
 
19
- $VERSION = '1.31';
19
+ $VERSION = '1.32';
20
20
 
21
21
  sub ProcessJpeg2000Box($$$);
22
22
  sub ProcessJUMD($$$);
@@ -42,8 +42,9 @@ my %jp2Map = (
42
42
  'UUID-IPTC' => 'JP2',
43
43
  'UUID-EXIF' => 'JP2',
44
44
  'UUID-XMP' => 'JP2',
45
- # jp2h => 'JP2', (not yet functional)
46
- # ICC_Profile => 'jp2h', (not yet functional)
45
+ jp2h => 'JP2',
46
+ colr => 'jp2h',
47
+ ICC_Profile => 'colr',
47
48
  IFD1 => 'IFD0',
48
49
  EXIF => 'IFD0', # to write EXIF as a block
49
50
  ExifIFD => 'IFD0',
@@ -560,11 +561,34 @@ my %j2cMarker = (
560
561
 
561
562
  %Image::ExifTool::Jpeg2000::ColorSpec = (
562
563
  PROCESS_PROC => \&Image::ExifTool::ProcessBinaryData,
564
+ WRITE_PROC => \&Image::ExifTool::WriteBinaryData, # (we don't actually call this)
563
565
  GROUPS => { 2 => 'Image' },
564
566
  FORMAT => 'int8s',
567
+ WRITABLE => 1,
568
+ # (Note: 'colr' is not a real group, but is used as a hack to write the
569
+ # necessary colr box. This hack necessitated another hack in TagInfoXML.pm
570
+ # to avoid reporting this fake group in the XML output)
571
+ WRITE_GROUP => 'colr',
572
+ DATAMEMBER => [ 0 ],
573
+ IS_SUBDIR => [ 3 ],
574
+ NOTES => q{
575
+ The table below contains tags in the color specification (colr) box. This
576
+ box may be rewritten by writing either ICC_Profile, ColorSpace or
577
+ ColorSpecData. When writing, any existing colr boxes are replaced with the
578
+ newly created colr box.
579
+
580
+ B<NOTE>: Care must be taken when writing this color specification because
581
+ writing a specification that is incompatible with the image data may make
582
+ the image undisplayable.
583
+ },
565
584
  0 => {
566
585
  Name => 'ColorSpecMethod',
567
586
  RawConv => '$$self{ColorSpecMethod} = $val',
587
+ Protected => 1,
588
+ Notes => q{
589
+ default for writing is 2 when writing ICC_Profile, 1 when writing
590
+ ColorSpace, or 4 when writing ColorSpecData
591
+ },
568
592
  PrintConv => {
569
593
  1 => 'Enumerated',
570
594
  2 => 'Restricted ICC',
@@ -572,9 +596,15 @@ my %j2cMarker = (
572
596
  4 => 'Vendor Color',
573
597
  },
574
598
  },
575
- 1 => 'ColorSpecPrecedence',
599
+ 1 => {
600
+ Name => 'ColorSpecPrecedence',
601
+ Notes => 'default for writing is 0',
602
+ Protected => 1,
603
+ },
576
604
  2 => {
577
605
  Name => 'ColorSpecApproximation',
606
+ Notes => 'default for writing is 0',
607
+ Protected => 1,
578
608
  PrintConv => {
579
609
  0 => 'Not Specified',
580
610
  1 => 'Accurate',
@@ -599,6 +629,7 @@ my %j2cMarker = (
599
629
  Name => 'ColorSpace',
600
630
  Condition => '$$self{ColorSpecMethod} == 1',
601
631
  Format => 'int32u',
632
+ Protected => 1,
602
633
  PrintConv => { # ref 15444-2 2002-05-15
603
634
  0 => 'Bi-level',
604
635
  1 => 'YCbCr(1)',
@@ -628,6 +659,8 @@ my %j2cMarker = (
628
659
  {
629
660
  Name => 'ColorSpecData',
630
661
  Format => 'undef[$size-3]',
662
+ Writable => 'undef',
663
+ Protected => 1,
631
664
  Binary => 1,
632
665
  },
633
666
  ],
@@ -817,6 +850,48 @@ sub CreateNewBoxes($$)
817
850
  return 1;
818
851
  }
819
852
 
853
+ #------------------------------------------------------------------------------
854
+ # Create Color Specification Box
855
+ # Inputs: 0) ExifTool object ref, 1) Output file or scalar ref
856
+ # Returns: 1 on success
857
+ sub CreateColorSpec($$)
858
+ {
859
+ my ($et, $outfile) = @_;
860
+ my $meth = $et->GetNewValue('Jpeg2000:ColorSpecMethod');
861
+ my $prec = $et->GetNewValue('Jpeg2000:ColorSpecPrecedence') || 0;
862
+ my $approx = $et->GetNewValue('Jpeg2000:ColorSpecApproximation') || 0;
863
+ my $icc = $et->GetNewValue('ICC_Profile');
864
+ my $space = $et->GetNewValue('Jpeg2000:ColorSpace');
865
+ my $cdata = $et->GetNewValue('Jpeg2000:ColorSpecData');
866
+ unless ($meth) {
867
+ if ($icc) {
868
+ $meth = 2;
869
+ } elsif (defined $space) {
870
+ $meth = 1;
871
+ } elsif (defined $cdata) {
872
+ $meth = 4;
873
+ } else {
874
+ $et->Warn('Color space not defined'), return 0;
875
+ }
876
+ }
877
+ if ($meth eq '1') {
878
+ defined $space or $et->Warn('Must specify ColorSpace'), return 0;
879
+ $cdata = pack('N', $space);
880
+ } elsif ($meth eq '2' or $meth eq '3') {
881
+ defined $icc or $et->Warn('Must specify ICC_Profile'), return 0;
882
+ $cdata = $icc;
883
+ } elsif ($meth eq '4') {
884
+ defined $cdata or $et->Warn('Must specify ColorSpecData'), return 0;
885
+ } else {
886
+ $et->Warn('Unknown ColorSpecMethod'), return 0;
887
+ }
888
+ my $boxhdr = pack('N', length($cdata) + 11) . 'colr';
889
+ Write($outfile, $boxhdr, pack('CCC',$meth,$prec,$approx), $cdata) or return 0;
890
+ ++$$et{CHANGED};
891
+ $et->VPrint(1, " + Jpeg2000:ColorSpec\n");
892
+ return 1;
893
+ }
894
+
820
895
  #------------------------------------------------------------------------------
821
896
  # Process JPEG 2000 box
822
897
  # Inputs: 0) ExifTool object reference, 1) dirInfo reference, 2) Pointer to tag table
@@ -834,7 +909,7 @@ sub ProcessJpeg2000Box($$$)
834
909
  my $raf = $$dirInfo{RAF};
835
910
  my $outfile = $$dirInfo{OutFile};
836
911
  my $dirEnd = $dirStart + $dirLen;
837
- my ($err, $outBuff, $verbose);
912
+ my ($err, $outBuff, $verbose, $doColour);
838
913
 
839
914
  if ($outfile) {
840
915
  unless ($raf) {
@@ -842,13 +917,19 @@ sub ProcessJpeg2000Box($$$)
842
917
  $outBuff = '';
843
918
  $outfile = \$outBuff;
844
919
  }
920
+ # determine if we will be writing colr box
921
+ if ($$dirInfo{DirName} and $$dirInfo{DirName} eq 'JP2Header') {
922
+ $doColour = 2 if defined $et->GetNewValue('ColorSpecMethod') or $et->GetNewValue('ICC_Profile') or
923
+ defined $et->GetNewValue('ColorSpecPrecedence') or defined $et->GetNewValue('ColorSpace') or
924
+ defined $et->GetNewValue('ColorSpecApproximation') or defined $et->GetNewValue('ColorSpecData');
925
+ }
845
926
  } else {
846
927
  # (must not set verbose flag when writing!)
847
928
  $verbose = $$et{OPTIONS}{Verbose};
848
929
  $et->VerboseDir($$dirInfo{DirName}) if $verbose;
849
930
  }
850
931
  # loop through all contained boxes
851
- my ($pos, $boxLen);
932
+ my ($pos, $boxLen, $lastBox);
852
933
  for ($pos=$dirStart; ; $pos+=$boxLen) {
853
934
  my ($boxID, $buff, $valuePtr);
854
935
  my $hdrLen = 8; # the box header length
@@ -857,9 +938,7 @@ sub ProcessJpeg2000Box($$$)
857
938
  my $n = $raf->Read($buff,$hdrLen);
858
939
  unless ($n == $hdrLen) {
859
940
  $n and $err = '', last;
860
- if ($outfile) {
861
- CreateNewBoxes($et, $outfile) or $err = 1;
862
- }
941
+ CreateNewBoxes($et, $outfile) or $err = 1 if $outfile;
863
942
  last;
864
943
  }
865
944
  $dataPt = \$buff;
@@ -871,6 +950,17 @@ sub ProcessJpeg2000Box($$$)
871
950
  }
872
951
  $boxLen = unpack("x$pos N",$$dataPt); # (length includes header and data)
873
952
  $boxID = substr($$dataPt, $pos+4, 4);
953
+ # remove old colr boxes if necessary
954
+ if ($doColour and $boxID eq 'colr') {
955
+ if ($doColour == 1) { # did we successfully write the new colr box?
956
+ $et->VPrint(1," - Jpeg2000:ColorSpec\n");
957
+ ++$$et{CHANGED};
958
+ next;
959
+ }
960
+ $et->Warn('Out-of-order colr box encountered');
961
+ undef $doColour;
962
+ }
963
+ $lastBox = $boxID;
874
964
  $pos += $hdrLen; # move to end of box header
875
965
  if ($boxLen == 1) {
876
966
  # box header contains an additional 8-byte integer for length
@@ -1009,8 +1099,10 @@ sub ProcessJpeg2000Box($$$)
1009
1099
  # remove this directory from our create list
1010
1100
  delete $$et{AddJp2Dirs}{$$tagInfo{Name}};
1011
1101
  my $newdir;
1012
- # only edit writable UUID and Exif boxes
1013
- if ($uuid or $boxID eq 'Exif' or ($boxID eq 'xml ' and $$et{IsJXL})) {
1102
+ # only edit writable UUID, Exif and jp2h boxes
1103
+ if ($uuid or $boxID eq 'Exif' or ($boxID eq 'xml ' and $$et{IsJXL}) or
1104
+ ($boxID eq 'jp2h' and $$et{EDIT_DIRS}{jp2h}))
1105
+ {
1014
1106
  $newdir = $et->WriteDirectory(\%subdirInfo, $subTable, $$subdir{WriteProc});
1015
1107
  next if defined $newdir and not length $newdir; # next if deleting the box
1016
1108
  } elsif (defined $uuid) {
@@ -1022,6 +1114,11 @@ sub ProcessJpeg2000Box($$$)
1022
1114
  my $boxhdr = pack('N', length($newdir) + 8 + $prefixLen) . $boxID;
1023
1115
  $boxhdr .= substr($$dataPt, $valuePtr, $prefixLen) if $prefixLen;
1024
1116
  Write($outfile, $boxhdr, $newdir) or $err = 1;
1117
+ # write new colr box immediately after ihdr
1118
+ if ($doColour and $boxID eq 'ihdr') {
1119
+ # (shouldn't be multiple ihdr boxes, but just in case, write only 1)
1120
+ $doColour = $doColour==2 ? CreateColorSpec($et, $outfile) : 0;
1121
+ }
1025
1122
  } else {
1026
1123
  # extract as a block if specified
1027
1124
  $subdirInfo{BlockInfo} = $tagInfo if $$tagInfo{BlockExtract};