exiftool_vendored 13.30.0 → 13.31.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.
@@ -111,7 +111,7 @@ my %insvLimit = (
111
111
  The tags below are extracted from timed metadata in QuickTime and other
112
112
  formats of video files when the ExtractEmbedded option is used. Although
113
113
  most of these tags are combined into the single table below, ExifTool
114
- currently reads 107 different types of timed GPS metadata from video files.
114
+ currently reads 110 different types of timed GPS metadata from video files.
115
115
  },
116
116
  GPSLatitude => { PrintConv => 'Image::ExifTool::GPS::ToDMS($self, $val, 1, "N")', RawConv => '$$self{FoundGPSLatitude} = 1; $val' },
117
117
  GPSLongitude => { PrintConv => 'Image::ExifTool::GPS::ToDMS($self, $val, 1, "E")' },
@@ -210,8 +210,8 @@ my %insvLimit = (
210
210
  ProcessProc => \&ProcessFMAS,
211
211
  },
212
212
  },{
213
- Name => 'gpmd_Wolfbox', # Wolfbox G900 Dashcam
214
- Condition => '$$valPt =~ /^.{136}0{16}HYTH/s',
213
+ Name => 'gpmd_Wolfbox', # Wolfbox G900 Dashcam and Redtiger F9 4K
214
+ Condition => '$$valPt =~ /^.{136}0{16}(HYTH|XXXX)/s',
215
215
  SubDirectory => {
216
216
  TagTable => 'Image::ExifTool::QuickTime::Stream',
217
217
  ProcessProc => \&ProcessWolfbox,
@@ -317,6 +317,8 @@ my %insvLimit = (
317
317
  ByteOrder => 'Little-Endian',
318
318
  },
319
319
  }],
320
+ # (have also seen unknown mett from Google Pixel with MetaType 'application/meta'
321
+ # and 'application/microvideo-image-meta')
320
322
  mett => { # Parrot drones and iPhone/Android using ARCore
321
323
  Name => 'mett',
322
324
  SubDirectory => { TagTable => 'Image::ExifTool::Parrot::mett' },
@@ -2288,6 +2290,7 @@ ATCRec: for ($recPos = 0x30; $recPos + 52 < $dirLen; $recPos += 52) {
2288
2290
  $lon = ($lon - 2199.19873715495) / 2;
2289
2291
  $ddd = 1;
2290
2292
  } elsif (Get32u($dataPt,0) == 0x400000 and abs($lat) <= 90 and abs($lon) <= 180) {
2293
+ $debug and $et->FoundTag(GPSType => '17c');
2291
2294
  # Transcend Drive Body Camera 70
2292
2295
  # 0000: 00 00 40 00 66 72 65 65 47 50 53 20 4c 00 00 00 [..@.freeGPS L...]
2293
2296
  # 0010: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 [................]
@@ -3567,14 +3570,14 @@ sub ProcessFMAS($$$)
3567
3570
  }
3568
3571
 
3569
3572
  #------------------------------------------------------------------------------
3570
- # Process GPS from Wolfbox G900 Dashcam
3573
+ # Process GPS from Wolfbox G900 Dashcam and Redtiger F9 4K
3571
3574
  # Inputs: 0) ExifTool object ref, 1) dirInfo ref, 2) tag table ref
3572
3575
  # Returns: 1 on success
3573
3576
  sub ProcessWolfbox($$$)
3574
3577
  {
3575
3578
  my ($et, $dirInfo, $tagTbl) = @_;
3576
3579
  my $dataPt = $$dirInfo{DataPt};
3577
- return 0 if length($$dataPt) < 0xc8;
3580
+ return 0 if length($$dataPt) < 0xf8;
3578
3581
  $et->VerboseDir('Wolfbox', undef, length($$dataPt));
3579
3582
  # 0000: 65 00 00 00 00 00 00 00 31 01 01 00 e3 ff 00 00 [e.......1.......]
3580
3583
  # 0010: 04 00 00 00 10 00 00 00 2a 00 00 00 00 00 00 00 [........*.......]
@@ -3593,22 +3596,43 @@ sub ProcessWolfbox($$$)
3593
3596
  # 00e0: 0a 00 00 00 00 00 00 00 e8 03 00 00 00 00 00 00 [................]
3594
3597
  # 00f0: 0a 00 00 00 00 00 00 00 4d 00 00 00 00 00 00 00 [........M.......]
3595
3598
  # lat/lon at 0xb0/0xc0 and 0x128/0x138
3596
- # h/m/s at 0x10 and 0xa0 and 0x148 (the first imprinted on the video, the latter 2 presumed UTC)
3599
+ # h/m/s at 0x10 and 0xa0 and 0x148 (the first imprinted on the video, and
3600
+ # the latter 2 presumed UTC, but there is a 1 second offset for the Redtiger)
3597
3601
  # spd at 0x48, dir at 0x58, alt at 0xe8
3602
+ # Redtiger F9 4K Dual Front and Rear Mini Dash Cam
3603
+ # 0000: 01 00 00 00 00 00 00 00 f4 ff 5d fe 24 00 00 00 [..........].$...]
3604
+ # 0010: 10 00 00 00 2d 00 00 00 25 00 00 00 00 00 00 00 [....-...%.......]
3605
+ # 0020: 01 00 00 00 00 00 00 00 44 eb 8f 00 00 00 00 00 [........D.......]
3606
+ # 0030: 10 27 00 00 00 00 00 00 1b 94 8a 04 00 00 00 00 [.'..............]
3607
+ # 0040: 10 27 00 00 00 00 00 00 8c 69 00 00 00 00 00 00 [.'.......i......]
3608
+ # 0050: e8 03 00 00 00 00 00 00 ba 47 00 00 00 00 00 00 [.........G......]
3609
+ # 0060: 64 00 00 00 00 00 00 00 19 00 00 00 05 00 00 00 [d...............]
3610
+ # 0070: e9 07 00 00 00 00 00 00 00 00 00 00 00 00 00 00 [................]
3611
+ # 0080: 00 00 00 00 00 00 00 00 30 30 30 30 30 30 30 30 [........00000000]
3612
+ # 0090: 30 30 30 30 30 30 30 30 58 58 58 58 00 00 00 00 [00000000XXXX....]
3613
+ # 00a0: 08 00 00 00 2d 00 00 00 24 00 00 00 00 00 00 00 [....-...$.......]
3614
+ # 00b0: 90 eb 8f 00 00 00 00 00 10 27 00 00 00 00 00 00 [.........'......]
3615
+ # 00c0: 20 94 8a 04 00 00 00 00 10 27 00 00 00 00 00 00 [ ........'......]
3616
+ # 00d0: 01 00 00 00 11 00 00 00 40 00 00 00 00 00 00 00 [........@.......]
3617
+ # 00e0: 64 00 00 00 00 00 00 00 8a 00 00 00 00 00 00 00 [d...............]
3618
+ # 00f0: 0a 00 00 00 00 00 00 00 4d 00 00 00 00 00 00 00 [........M.......]
3598
3619
  SetByteOrder('II');
3599
- my ($spd,$dir,$d,$mo,$yr,$h,$m,$s) = unpack('x72Vx12Vx12V3x44V3',$$dataPt);
3600
- # offset 0xa0 also stores hh mm ss, but is out by 8 hours!
3620
+ my ($d,$mo,$yr,$h,$m,$s) = unpack('x104V3x44V3',$$dataPt);
3601
3621
  my $time = sprintf '%.4d:%.2d:%.2d %.2d:%.2d:%.2dZ', $yr, $mo, $d, $h, $m, $s;
3602
- my ($lat, $lon) = (Get32s($dataPt, 0xb0) / 1e5, Get32s($dataPt, 0xc0) / 1e5);
3603
- my $alt = Get32s($dataPt, 0xe8);
3604
- ConvertLatLon($lat, $lon);
3622
+ my ($pos, @a);
3623
+ # 0=spd 1=dir 2=lat 3=lon 4=alt
3624
+ foreach $pos (0x48, 0x58, 0xb0, 0xc0, 0xe8) {
3625
+ my $val = Get64s($dataPt, $pos);
3626
+ my $scl = Get64s($dataPt, $pos + 8);
3627
+ push @a, $val / ($scl || 1);
3628
+ }
3629
+ ConvertLatLon($a[2], $a[3]);
3605
3630
  $et->HandleTag($tagTbl, GPSDateTime => $time);
3606
- $et->HandleTag($tagTbl, GPSLatitude => $lat);
3607
- $et->HandleTag($tagTbl, GPSLongitude => $lon);
3608
- $et->HandleTag($tagTbl, GPSSpeed => $spd * $knotsToKph / 100);
3609
- $et->HandleTag($tagTbl, GPSTrack => $dir / 100);
3610
- $et->HandleTag($tagTbl, GPSAltitude => $alt / 10); # (NC)
3611
- SetByteOrder('MM');
3631
+ $et->HandleTag($tagTbl, GPSLatitude => $a[2]);
3632
+ $et->HandleTag($tagTbl, GPSLongitude => $a[3]);
3633
+ $et->HandleTag($tagTbl, GPSSpeed => $a[0] * $knotsToKph);
3634
+ $et->HandleTag($tagTbl, GPSTrack => $a[1]);
3635
+ $et->HandleTag($tagTbl, GPSAltitude => $a[4]);
3612
3636
  return 1;
3613
3637
  }
3614
3638
 
@@ -19,7 +19,7 @@ use strict;
19
19
  use vars qw($VERSION %sigmaLensTypes);
20
20
  use Image::ExifTool::Exif;
21
21
 
22
- $VERSION = '1.35';
22
+ $VERSION = '1.36';
23
23
 
24
24
  # sigma LensType lookup (ref IB)
25
25
  %sigmaLensTypes = (
@@ -704,6 +704,12 @@ $VERSION = '1.35';
704
704
  Name => 'PictureMode',
705
705
  Notes => 'same as ColorMode, but "Standard" when ColorMode is Sepia or B&W',
706
706
  },
707
+ 0x0047 => { #forum17338
708
+ Name => 'ExposureCompensation',
709
+ Writable => 'rational64s',
710
+ PrintConv => '$val and $val =~ s/^(\d)/\+$1/; $val',
711
+ PrintConvInv => '$val',
712
+ },
707
713
  0x0048 => { #PH
708
714
  Name => 'LensApertureRange',
709
715
  Condition => '$$self{MakerNoteSigmaVer} >= 3',
@@ -797,6 +803,10 @@ $VERSION = '1.35';
797
803
  0x0087 => 'ResolutionMode', #PH (Quattro models)
798
804
  0x0088 => 'WhiteBalance', #PH (Quattro models)
799
805
  0x008c => 'Firmware', #PH (Quattro models)
806
+ 0x0113 => { #forum17338
807
+ Name => 'PictureModeStrength',
808
+ Writable => 'int32s',
809
+ },
800
810
  0x011f => { #IB (FP DNG images)
801
811
  Name => 'CameraCalibration',
802
812
  Writable => 'float',
@@ -810,6 +820,14 @@ $VERSION = '1.35';
810
820
  Name => 'WBSettings2',
811
821
  SubDirectory => { TagTable => 'Image::ExifTool::Sigma::WBSettings2' },
812
822
  },
823
+ 0x0138 => { #forum17338
824
+ Name => 'Fade',
825
+ Writable => 'rational64u',
826
+ },
827
+ 0x0139 => { #forum17338
828
+ Name => 'Vignette',
829
+ Writable => 'rational64u',
830
+ },
813
831
  );
814
832
 
815
833
  # WB settings (ref IB)
@@ -2822,7 +2822,7 @@ my %tagLookup = (
2822
2822
  'exposurebracketstepsize' => { 375 => 0x8 },
2823
2823
  'exposurebracketvalue' => { 246 => 0x19 },
2824
2824
  'exposurecompautocancel' => { 90 => 0x113 },
2825
- 'exposurecompensation' => { 82 => 0x6, 99 => 0x0, 125 => 0x9204, 147 => 0x24, 163 => 'ExposureComp', 183 => 'ExposureCompensation', 188 => 0xd, 189 => 0x53, 190 => 0x1e, 194 => 0x49c0, 339 => 0x1006, 395 => 0x16, 404 => 0x402, 436 => 0xa013, 439 => [0xc,0x35,0x4d], 472 => 0x114c, 473 => 0x114c, 474 => 0x1128, 476 => 0x1180, 477 => 0x1038, 478 => 0x230, 479 => 0x230, 480 => 0x223, 534 => 'ExposureBiasValue' },
2825
+ 'exposurecompensation' => { 82 => 0x6, 99 => 0x0, 125 => 0x9204, 147 => 0x24, 163 => 'ExposureComp', 183 => 'ExposureCompensation', 188 => 0xd, 189 => 0x53, 190 => 0x1e, 194 => 0x49c0, 339 => 0x1006, 395 => 0x16, 404 => 0x402, 436 => 0xa013, 439 => [0xc,0x35,0x47,0x4d], 472 => 0x114c, 473 => 0x114c, 474 => 0x1128, 476 => 0x1180, 477 => 0x1038, 478 => 0x230, 479 => 0x230, 480 => 0x223, 534 => 'ExposureBiasValue' },
2826
2826
  'exposurecompensation2' => { 468 => [0x24,0x26,0x2a] },
2827
2827
  'exposurecompensationbutton' => { 257 => 0x794 },
2828
2828
  'exposurecompensationmode' => { 191 => 0x47, 194 => 0x2a },
@@ -2978,7 +2978,7 @@ my %tagLookup = (
2978
2978
  'facesdetected' => { 58 => 0x2, 59 => 0x2, 60 => 0x3, 116 => 0x0, 117 => 0x2, 119 => 0x211c, 133 => 0x4100, 222 => 0x3, 338 => 0x1200, 358 => 0x3f, 378 => 0x0, 426 => 0xb5, 437 => 0x0, 456 => 0x0, 459 => 0x3, 471 => 0x30 },
2979
2979
  'facesrecognized' => { 351 => 0x0 },
2980
2980
  'facewidth' => { 59 => 0x1 },
2981
- 'fade' => { 463 => 0x2034 },
2981
+ 'fade' => { 439 => 0x138, 463 => 0x2034 },
2982
2982
  'faithfuloutputhighlightpoint' => { 115 => 0x38 },
2983
2983
  'faithfuloutputshadowpoint' => { 115 => 0x39 },
2984
2984
  'faithfulrawcolortone' => { 115 => 0x31 },
@@ -5667,6 +5667,7 @@ my %tagLookup = (
5667
5667
  'picturemodehue' => { 334 => 0x522 },
5668
5668
  'picturemodesaturation' => { 334 => 0x521 },
5669
5669
  'picturemodesharpness' => { 334 => 0x524 },
5670
+ 'picturemodestrength' => { 439 => 0x113 },
5670
5671
  'picturemodetone' => { 334 => 0x526 },
5671
5672
  'pictureprofile' => { 472 => [0x115e,0x115f], 473 => [0x1162,0x1163], 474 => [0x113e,0x113f], 475 => [0x11ba,0x11bb], 476 => [0x1196,0x1197], 477 => [0x104e,0x104f], 478 => [0x246,0x247], 479 => [0x246,0x247], 480 => [0x237,0x238] },
5672
5673
  'picturestyle' => { 8 => [0x4b,0x51], 9 => 0xf4, 10 => 0x6c, 11 => 0x86, 12 => 0x73, 16 => 0xab, 17 => 0xa7, 18 => 0xb0, 19 => 0x6c, 20 => 0xa7, 21 => 0xf4, 22 => 0xb3, 24 => 0xf4, 25 => 0xfa, 27 => 0x169, 79 => 0xa, 109 => 0x20301, 115 => 0x2 },
@@ -7302,6 +7303,7 @@ my %tagLookup = (
7302
7303
  'viewingmode2' => { 451 => [0x85,0x285] },
7303
7304
  'viewmodeshoweffectsofsettings' => { 257 => 0x7d2, 330 => 0x2a9 },
7304
7305
  'viewpoint' => { 547 => 'viewpoint' },
7306
+ 'vignette' => { 439 => 0x139 },
7305
7307
  'vignetteamount' => { 528 => 'VignetteAmount', 530 => 'VignetteAmount' },
7306
7308
  'vignettecoefficient1' => { 297 => 0x24 },
7307
7309
  'vignettecoefficient2' => { 297 => 0x34 },
@@ -10858,6 +10860,7 @@ my %tagExists = (
10858
10860
  'mebx' => 1,
10859
10861
  'media' => 1,
10860
10862
  'mediablackpoint' => 1,
10863
+ 'mediabox' => 1,
10861
10864
  'mediacolor' => 1,
10862
10865
  'mediacontenttypes' => 1,
10863
10866
  'mediacreated' => 1,
@@ -12,7 +12,7 @@ meta information extracted from or written to a file.
12
12
  =head1 TAG TABLES
13
13
 
14
14
  The tables listed below give the names of all tags recognized by ExifTool.
15
- They contain a total of 28450 tags, with 17673 unique tag names.
15
+ They contain a total of 28455 tags, with 17676 unique tag names.
16
16
 
17
17
  B<Tag ID>, B<Index#> or B<Sequence> is given in the first column of each
18
18
  table. A B<Tag ID> is the computer-readable equivalent of a tag name, and
@@ -21811,6 +21811,7 @@ are less than consistent about their metadata formats.
21811
21811
  0x003b Firmware string
21812
21812
  0x003c WhiteBalance string
21813
21813
  0x003d PictureMode string
21814
+ 0x0047 ExposureCompensation rational64s
21814
21815
  0x0048 LensApertureRange string
21815
21816
  0x0049 FNumber rational64u
21816
21817
  0x004a ExposureTime rational64u
@@ -21826,9 +21827,12 @@ are less than consistent about their metadata formats.
21826
21827
  0x0087 ResolutionMode string
21827
21828
  0x0088 WhiteBalance string
21828
21829
  0x008c Firmware string
21830
+ 0x0113 PictureModeStrength int32s
21829
21831
  0x011f CameraCalibration float[9]
21830
21832
  0x0120 WBSettings Sigma WBSettings
21831
21833
  0x0121 WBSettings2 Sigma WBSettings2
21834
+ 0x0138 Fade rational64u
21835
+ 0x0139 Vignette rational64u
21832
21836
 
21833
21837
  =head3 Sigma WBSettings Tags
21834
21838
 
@@ -29664,10 +29668,11 @@ C2PA JUMBF metadata extracted from "/C2PA_Manifest" file.
29664
29668
 
29665
29669
  =head3 PDF Pages Tags
29666
29670
 
29667
- Tag ID Tag Name Writable
29668
- ------ -------- --------
29669
- 'Count' PageCount no
29670
- 'Kids' Kids PDF Kids
29671
+ Tag ID Tag Name Writable
29672
+ ------ -------- --------
29673
+ 'Count' PageCount no
29674
+ 'Kids' Kids PDF Kids
29675
+ 'MediaBox' MediaBox no+
29671
29676
 
29672
29677
  =head3 PDF Kids Tags
29673
29678
 
@@ -30380,7 +30385,7 @@ for the official QuickTime specification.
30380
30385
  The tags below are extracted from timed metadata in QuickTime and other
30381
30386
  formats of video files when the ExtractEmbedded option is used. Although
30382
30387
  most of these tags are combined into the single table below, ExifTool
30383
- currently reads 107 different types of timed GPS metadata from video files.
30388
+ currently reads 110 different types of timed GPS metadata from video files.
30384
30389
 
30385
30390
  Tag ID Tag Name Writable
30386
30391
  ------ -------- --------
@@ -81,6 +81,7 @@ sub WritePDFValue($$$)
81
81
  EncodeString(\$val);
82
82
  } elsif ($format eq 'date') {
83
83
  # convert date to "D:YYYYmmddHHMMSS+-HH'MM'" format
84
+ $val =~ s/(:\d{2})\.\d*/$1/; # remove sub-seconds
84
85
  $val =~ s/([-+]\d{2}):(\d{2})/${1}'${2}'/; # change timezone delimiters if necessary
85
86
  $val =~ tr/ ://d; # remove spaces and colons
86
87
  $val = "D:$val"; # add leading "D:"
@@ -4741,10 +4741,11 @@ sub DumpUnknownTrailer($$)
4741
4741
  my $pos = $$dirInfo{DataPos};
4742
4742
  my $endPos = $pos + $$dirInfo{DirLen};
4743
4743
  # account for preview/MPF image trailer
4744
- my $prePos = $$self{VALUE}{PreviewImageStart} || $$self{PreviewImageStart};
4745
- my $preLen = $$self{VALUE}{PreviewImageLength} || $$self{PreviewImageLength};
4746
- my $hidPos = $$self{VALUE}{HiddenDataOffset};
4747
- my $hidLen = $$self{VALUE}{HiddenDataLength};
4744
+ my $value = $$self{VALUE};
4745
+ my $prePos = $$value{PreviewImageStart} || $$self{PreviewImageStart};
4746
+ my $preLen = $$value{PreviewImageLength} || $$self{PreviewImageLength};
4747
+ my $hidPos = $$value{HiddenDataOffset};
4748
+ my $hidLen = $$value{HiddenDataLength};
4748
4749
  my $tag = 'PreviewImage';
4749
4750
  my $mpImageNum = 0;
4750
4751
  my (%image, $lastOne);
@@ -4761,12 +4762,12 @@ sub DumpUnknownTrailer($$)
4761
4762
  last if $lastOne; # checked all images
4762
4763
  # look for MPF images (in the proper order)
4763
4764
  ++$mpImageNum;
4764
- $prePos = $$self{VALUE}{"MPImageStart ($mpImageNum)"};
4765
+ $prePos = $$value{"MPImageStart ($mpImageNum)"};
4765
4766
  if (defined $prePos) {
4766
- $preLen = $$self{VALUE}{"MPImageLength ($mpImageNum)"};
4767
+ $preLen = $$value{"MPImageLength ($mpImageNum)"};
4767
4768
  } else {
4768
- $prePos = $$self{VALUE}{'MPImageStart'};
4769
- $preLen = $$self{VALUE}{'MPImageLength'};
4769
+ $prePos = $$value{MPImageStart};
4770
+ $preLen = $$value{MPImageLength};
4770
4771
  $lastOne = 1;
4771
4772
  }
4772
4773
  $tag = "MPImage$mpImageNum";
@@ -5887,10 +5888,10 @@ sub WriteJPEG($$)
5887
5888
  $writeBuffer = '';
5888
5889
  $oldOutfile = $outfile;
5889
5890
  $outfile = \$writeBuffer;
5890
- # account for segment, EXIF and TIFF headers
5891
- $$self{PREVIEW_INFO}{Fixup}{Start} += 18 if $$self{PREVIEW_INFO};
5892
- $$self{LeicaTrailer}{Fixup}{Start} += 18 if $$self{LeicaTrailer};
5893
- $$self{HiddenData}{Fixup}{Start} += 18 if $$self{HiddenData};
5891
+ # must account for segment, EXIF and TIFF headers
5892
+ foreach (qw(PREVIEW_INFO LeicaTrailer HiddenData)) {
5893
+ $$self{$_}{Fixup}{Start} += 18 if $$self{$_};
5894
+ }
5894
5895
  }
5895
5896
  # write as multi-segment
5896
5897
  my $n = WriteMultiSegment($outfile, 0xe1, $exifAPP1hdr, \$buff, 'EXIF');
@@ -6036,8 +6037,8 @@ sub WriteJPEG($$)
6036
6037
  my $delPreview = $$self{DEL_PREVIEW};
6037
6038
  $trailInfo = $self->IdentifyTrailer($raf) unless $$delGroup{Trailer};
6038
6039
  my $nvTrail = $self->GetNewValueHash($Image::ExifTool::Extra{Trailer});
6039
- unless ($oldOutfile or $delPreview or $trailInfo or $$delGroup{Trailer} or $nvTrail or
6040
- $$self{HiddenData})
6040
+ unless ($oldOutfile or $delPreview or $trailInfo or $$delGroup{Trailer} or
6041
+ $nvTrail or $$self{HiddenData})
6041
6042
  {
6042
6043
  # blindly copy the rest of the file
6043
6044
  while ($raf->Read($buff, 65536)) {
@@ -6082,35 +6083,7 @@ sub WriteJPEG($$)
6082
6083
  }
6083
6084
  last; # all done
6084
6085
  }
6085
- # copy HiddenData if necessary
6086
- if ($$self{HiddenData}) {
6087
- my $pad;
6088
- my $hd = $$self{HiddenData};
6089
- my $hdOff = $$hd{Offset} + $$hd{Base};
6090
- require Image::ExifTool::Sony;
6091
- # read HiddenData, updating $hdOff with actual offset if necessary
6092
- my $dataPt = Image::ExifTool::Sony::ReadHiddenData($self, $hdOff, $$hd{Size});
6093
- if ($dataPt) {
6094
- # preserve padding to avoid invalidating MPF pointers (yuk!)
6095
- my $padLen = $hdOff - $endPos;
6096
- unless ($padLen >= 0 and $raf->Seek($endPos,0) and $raf->Read($pad,$padLen)==$padLen) {
6097
- $self->Error('Error reading HiddenData padding',1);
6098
- $pad = '';
6099
- }
6100
- $endPos += length($pad) + length($$dataPt); # update end position
6101
- } else {
6102
- $$dataPt = $pad = '';
6103
- }
6104
- my $fixup = $$self{HiddenData}{Fixup};
6105
- # set MakerNote pointer and size (subtract 10 for segment and EXIF headers)
6106
- $fixup->SetMarkerPointers($outfile, 'HiddenData', length($$outfile) + length($pad) - 10);
6107
- # clean up and write the buffered data
6108
- $outfile = $oldOutfile;
6109
- undef $oldOutfile;
6110
- Write($outfile, $writeBuffer, $pad, $$dataPt) or $err = 1;
6111
- undef $writeBuffer;
6112
- }
6113
- # rewrite existing trailers
6086
+ # rewrite existing trailers into buffer
6114
6087
  if ($trailInfo) {
6115
6088
  my $tbuf = '';
6116
6089
  $raf->Seek(-length($buff), 1); # seek back to just after EOI
@@ -6118,100 +6091,126 @@ sub WriteJPEG($$)
6118
6091
  $$trailInfo{ScanForTrailer} = 1;# scan if necessary
6119
6092
  $self->ProcessTrailers($trailInfo) or undef $trailInfo;
6120
6093
  }
6121
- if (not $oldOutfile) {
6122
- # do nothing special
6123
- } elsif ($$self{LeicaTrailer}) {
6124
- my $trailLen;
6125
- if ($trailInfo) {
6126
- $trailLen = $$trailInfo{DataPos} - $endPos;
6127
- } else {
6128
- $raf->Seek(0, 2) or $err = 1;
6129
- $trailLen = $raf->Tell() - $endPos;
6130
- }
6131
- my $fixup = $$self{LeicaTrailer}{Fixup};
6132
- $$self{LeicaTrailer}{TrailPos} = $endPos;
6133
- $$self{LeicaTrailer}{TrailLen} = $trailLen;
6134
- # get _absolute_ position of new Leica trailer
6135
- my $absPos = Tell($oldOutfile) + length($$outfile);
6136
- require Image::ExifTool::Panasonic;
6137
- my $dat = Image::ExifTool::Panasonic::ProcessLeicaTrailer($self, $absPos);
6138
- # allow some junk before Leica trailer (just in case)
6139
- my $junk = $$self{LeicaTrailerPos} - $endPos;
6140
- # set MakerNote pointer and size (subtract 10 for segment and EXIF headers)
6141
- $fixup->SetMarkerPointers($outfile, 'LeicaTrailer', length($$outfile) - 10 + $junk);
6142
- # use this fixup to set the size too (sneaky)
6143
- my $trailSize = defined($dat) ? length($dat) - $junk : $$self{LeicaTrailer}{Size};
6144
- $$fixup{Start} -= 4; $$fixup{Shift} += 4;
6145
- $fixup->SetMarkerPointers($outfile, 'LeicaTrailer', $trailSize) if defined $trailSize;
6146
- $$fixup{Start} += 4; $$fixup{Shift} -= 4;
6147
- # clean up and write the buffered data
6148
- $outfile = $oldOutfile;
6149
- undef $oldOutfile;
6150
- Write($outfile, $writeBuffer) or $err = 1;
6151
- undef $writeBuffer;
6152
- if (defined $dat) {
6153
- Write($outfile, $dat) or $err = 1; # write new Leica trailer
6154
- $delPreview = 1; # delete existing Leica trailer
6094
+ if ($oldOutfile) {
6095
+ my $previewInfo;
6096
+ # copy HiddenData if necessary
6097
+ if ($$self{HiddenData}) {
6098
+ my $pad;
6099
+ my $hd = $$self{HiddenData};
6100
+ my $hdOff = $$hd{Offset} + $$hd{Base};
6101
+ require Image::ExifTool::Sony;
6102
+ # read HiddenData, updating $hdOff with actual offset if necessary
6103
+ my $dataPt = Image::ExifTool::Sony::ReadHiddenData($self, $hdOff, $$hd{Size});
6104
+ if ($dataPt) {
6105
+ # preserve padding to avoid invalidating MPF pointers (yuk!)
6106
+ my $padLen = $hdOff - $endPos;
6107
+ unless ($padLen >= 0 and $raf->Seek($endPos,0) and $raf->Read($pad,$padLen)==$padLen) {
6108
+ $self->Error('Error reading HiddenData padding',1);
6109
+ $pad = '';
6110
+ }
6111
+ $endPos += length($pad) + length($$dataPt); # update end position
6112
+ } else {
6113
+ $$dataPt = $pad = '';
6114
+ }
6115
+ my $fixup = $$self{HiddenData}{Fixup};
6116
+ # set MakerNote pointer and size (subtract 10 for segment and EXIF headers)
6117
+ $fixup->SetMarkerPointers($outfile, 'HiddenData', length($$outfile) + length($pad) - 10);
6118
+ $writeBuffer .= $pad . $$dataPt; # keep padding for now
6155
6119
  }
6156
- } else {
6157
- # locate preview image and fix up preview offsets
6158
- my $scanLen = $$self{Make} =~ /^SONY/i ? 65536 : 1024;
6159
- if (length($buff) < $scanLen) { # make sure we have enough trailer to scan
6160
- my $buf2;
6161
- $buff .= $buf2 if $raf->Read($buf2, $scanLen - length($buff));
6120
+ if ($$self{LeicaTrailer}) {
6121
+ my $trailLen;
6122
+ if ($trailInfo) {
6123
+ $trailLen = $$trailInfo{DataPos} - $endPos;
6124
+ } else {
6125
+ $raf->Seek(0, 2) or $err = 1;
6126
+ $trailLen = $raf->Tell() - $endPos;
6127
+ }
6128
+ my $fixup = $$self{LeicaTrailer}{Fixup};
6129
+ $$self{LeicaTrailer}{TrailPos} = $endPos;
6130
+ $$self{LeicaTrailer}{TrailLen} = $trailLen;
6131
+ # get _absolute_ position of new Leica trailer
6132
+ my $absPos = Tell($oldOutfile) + length($$outfile);
6133
+ require Image::ExifTool::Panasonic;
6134
+ my $dat = Image::ExifTool::Panasonic::ProcessLeicaTrailer($self, $absPos);
6135
+ # allow some junk before Leica trailer (just in case)
6136
+ my $junk = $$self{LeicaTrailerPos} - $endPos;
6137
+ # set MakerNote pointer and size (subtract 10 for segment and EXIF headers)
6138
+ $fixup->SetMarkerPointers($outfile, 'LeicaTrailer', length($$outfile) - 10 + $junk);
6139
+ # use this fixup to set the size too (sneaky)
6140
+ my $trailSize = defined($dat) ? length($dat) - $junk : $$self{LeicaTrailer}{Size};
6141
+ $$fixup{Start} -= 4; $$fixup{Shift} += 4;
6142
+ $fixup->SetMarkerPointers($outfile, 'LeicaTrailer', $trailSize) if defined $trailSize;
6143
+ $$fixup{Start} += 4; $$fixup{Shift} -= 4;
6144
+ if (defined $dat) {
6145
+ Write($outfile, $dat) or $err = 1; # write new Leica trailer
6146
+ $delPreview = 1; # delete existing Leica trailer
6147
+ }
6162
6148
  }
6163
- # get new preview image position, relative to EXIF base
6164
- my $newPos = length($$outfile) - 10; # (subtract 10 for segment and EXIF headers)
6165
- my $junkLen;
6166
- # adjust position if image isn't at the start (eg. Olympus E-1/E-300)
6167
- if ($buff =~ /(\xff\xd8\xff.|.\xd8\xff\xdb)(..)/sg) {
6168
- my ($jpegHdr, $segLen) = ($1, $2);
6169
- $junkLen = pos($buff) - 6;
6170
- # Sony previewimage trailer has a 32 byte header
6171
- if ($$self{Make} =~ /^SONY/i and $junkLen > 32) {
6172
- # with some newer Sony models, the makernotes preview pointer
6173
- # points to JPEG at end of EXIF inside MPImage preview (what a pain!)
6174
- if ($jpegHdr eq "\xff\xd8\xff\xe1") { # is the first segment EXIF?
6175
- $segLen = unpack('n', $segLen); # the EXIF segment length
6176
- # Sony PreviewImage starts with last 2 bytes of EXIF segment
6177
- # (and first byte is usually "\0", not "\xff", so don't check this)
6178
- if (length($buff) > $junkLen + $segLen + 6 and
6179
- substr($buff, $junkLen + $segLen + 3, 3) eq "\xd8\xff\xdb")
6180
- {
6181
- $junkLen += $segLen + 2;
6182
- # (note: this will not copy the trailer after PreviewImage,
6183
- # which is a 14kB block full of zeros for the A77)
6149
+ # handle preview image last
6150
+ if ($$self{PREVIEW_INFO}) {
6151
+ # locate preview image and fix up preview offsets
6152
+ my $scanLen = $$self{Make} =~ /^SONY/i ? 65536 : 1024;
6153
+ if (length($buff) < $scanLen) { # make sure we have enough trailer to scan
6154
+ my $buf2;
6155
+ $buff .= $buf2 if $raf->Read($buf2, $scanLen - length($buff));
6156
+ }
6157
+ # get new preview image position, relative to EXIF base
6158
+ my $newPos = length($$outfile) - 10; # (subtract 10 for segment and EXIF headers)
6159
+ my $junkLen;
6160
+ # adjust position if image isn't at the start (eg. Olympus E-1/E-300)
6161
+ if ($buff =~ /(\xff\xd8\xff.|.\xd8\xff\xdb)(..)/sg) {
6162
+ my ($jpegHdr, $segLen) = ($1, $2);
6163
+ $junkLen = pos($buff) - 6;
6164
+ # Sony previewimage trailer has a 32 byte header
6165
+ if ($$self{Make} =~ /^SONY/i and $junkLen > 32) {
6166
+ # with some newer Sony models, the makernotes preview pointer
6167
+ # points to JPEG at end of EXIF inside MPImage preview (what a pain!)
6168
+ if ($jpegHdr eq "\xff\xd8\xff\xe1") { # is the first segment EXIF?
6169
+ $segLen = unpack('n', $segLen); # the EXIF segment length
6170
+ # Sony PreviewImage starts with last 2 bytes of EXIF segment
6171
+ # (and first byte is usually "\0", not "\xff", so don't check this)
6172
+ if (length($buff) > $junkLen + $segLen + 6 and
6173
+ substr($buff, $junkLen + $segLen + 3, 3) eq "\xd8\xff\xdb")
6174
+ {
6175
+ $junkLen += $segLen + 2;
6176
+ # (note: this will not copy the trailer after PreviewImage,
6177
+ # which is a 14kB block full of zeros for the A77)
6178
+ }
6184
6179
  }
6180
+ $junkLen -= 32;
6185
6181
  }
6186
- $junkLen -= 32;
6182
+ $newPos += $junkLen;
6183
+ }
6184
+ # fix up the preview offsets to point to the start of the new image
6185
+ $previewInfo = $$self{PREVIEW_INFO};
6186
+ delete $$self{PREVIEW_INFO};
6187
+ my $fixup = $$previewInfo{Fixup};
6188
+ $newPos += ($$previewInfo{BaseShift} || 0);
6189
+ # adjust to absolute file offset if necessary (Samsung STMN)
6190
+ $newPos += Tell($oldOutfile) + 10 if $$previewInfo{Absolute};
6191
+ if ($$previewInfo{Relative}) {
6192
+ # adjust for our base by looking at how far the pointer got shifted
6193
+ $newPos -= ($fixup->GetMarkerPointers($outfile, 'PreviewImage') || 0);
6194
+ } elsif ($$previewInfo{ChangeBase}) {
6195
+ # Leica S2 uses relative offsets for the preview only (leica sucks)
6196
+ my $makerOffset = $fixup->GetMarkerPointers($outfile, 'LeicaTrailer');
6197
+ $newPos -= $makerOffset if $makerOffset;
6198
+ }
6199
+ $fixup->SetMarkerPointers($outfile, 'PreviewImage', $newPos);
6200
+ if ($$previewInfo{Data} ne 'LOAD_PREVIEW') {
6201
+ # write any junk that existed before the preview image
6202
+ $$previewInfo{Junk} = substr($buff,0,$junkLen) if $junkLen;
6187
6203
  }
6188
- $newPos += $junkLen;
6189
- }
6190
- # fix up the preview offsets to point to the start of the new image
6191
- my $previewInfo = $$self{PREVIEW_INFO};
6192
- delete $$self{PREVIEW_INFO};
6193
- my $fixup = $$previewInfo{Fixup};
6194
- $newPos += ($$previewInfo{BaseShift} || 0);
6195
- # adjust to absolute file offset if necessary (Samsung STMN)
6196
- $newPos += Tell($oldOutfile) + 10 if $$previewInfo{Absolute};
6197
- if ($$previewInfo{Relative}) {
6198
- # adjust for our base by looking at how far the pointer got shifted
6199
- $newPos -= ($fixup->GetMarkerPointers($outfile, 'PreviewImage') || 0);
6200
- } elsif ($$previewInfo{ChangeBase}) {
6201
- # Leica S2 uses relative offsets for the preview only (leica sucks)
6202
- my $makerOffset = $fixup->GetMarkerPointers($outfile, 'LeicaTrailer');
6203
- $newPos -= $makerOffset if $makerOffset;
6204
6204
  }
6205
- $fixup->SetMarkerPointers($outfile, 'PreviewImage', $newPos);
6206
6205
  # clean up and write the buffered data
6207
6206
  $outfile = $oldOutfile;
6208
6207
  undef $oldOutfile;
6209
6208
  Write($outfile, $writeBuffer) or $err = 1;
6210
6209
  undef $writeBuffer;
6211
6210
  # write preview image
6212
- if ($$previewInfo{Data} ne 'LOAD_PREVIEW') {
6211
+ if ($previewInfo and $$previewInfo{Data} ne 'LOAD_PREVIEW') {
6213
6212
  # write any junk that existed before the preview image
6214
- Write($outfile, substr($buff,0,$junkLen)) or $err = 1 if $junkLen;
6213
+ Write($outfile, $$previewInfo{Junk}) or $err = 1 if defined $$previewInfo{Junk};
6215
6214
  # write the saved preview image
6216
6215
  Write($outfile, $$previewInfo{Data}) or $err = 1;
6217
6216
  delete $$previewInfo{Data};
@@ -6224,7 +6223,7 @@ sub WriteJPEG($$)
6224
6223
  my $extra;
6225
6224
  if ($trailInfo) {
6226
6225
  # copy everything up to start of first processed trailer
6227
- $extra = $$trailInfo{DataPos} - $endPos;
6226
+ $extra = defined $$trailInfo{DataPos} ? ($$trailInfo{DataPos} - $endPos) : 0;
6228
6227
  } else {
6229
6228
  # copy everything up to end of file
6230
6229
  $raf->Seek(0, 2) or $err = 1;
@@ -6393,9 +6392,9 @@ sub WriteJPEG($$)
6393
6392
  $oldOutfile = $outfile;
6394
6393
  $outfile = \$writeBuffer;
6395
6394
  # must account for segment, EXIF and TIFF headers
6396
- $$self{PREVIEW_INFO}{Fixup}{Start} += 18 if $$self{PREVIEW_INFO};
6397
- $$self{LeicaTrailer}{Fixup}{Start} += 18 if $$self{LeicaTrailer};
6398
- $$self{HiddenData}{Fixup}{Start} += 18 if $$self{HiddenData};
6395
+ foreach (qw(PREVIEW_INFO LeicaTrailer HiddenData)) {
6396
+ $$self{$_}{Fixup}{Start} += 18 if $$self{$_};
6397
+ }
6399
6398
  }
6400
6399
  # write as multi-segment
6401
6400
  my $n = WriteMultiSegment($outfile, $marker, $exifAPP1hdr, $segDataPt, 'EXIF');
@@ -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 $advFmtSelf $configFile @configFiles $noConfig);
31
31
 
32
- $VERSION = '13.30';
32
+ $VERSION = '13.31';
33
33
  $RELEASE = '';
34
34
  @ISA = qw(Exporter);
35
35
  %EXPORT_TAGS = (
@@ -42,7 +42,7 @@ $RELEASE = '';
42
42
  # exports not part of the public API, but used by ExifTool modules:
43
43
  DataAccess => [qw(
44
44
  ReadValue GetByteOrder SetByteOrder ToggleByteOrder Get8u Get8s Get16u
45
- Get16s Get32u Get32s Get64u GetFloat GetDouble GetFixed32s Write
45
+ Get16s Get32u Get32s Get64u Get64s GetFloat GetDouble GetFixed32s Write
46
46
  WriteValue Tell Set8u Set8s Set16u Set32u Set64u Set64s
47
47
  )],
48
48
  Utils => [qw(GetTagTable TagTableKeys GetTagInfoList AddTagToTable HexDump)],
@@ -9719,8 +9719,10 @@ sub ExtractBinary($$$;$)
9719
9719
  $isPreview = 1;
9720
9720
  }
9721
9721
  my $lcTag = lc $tag;
9722
- if ((not $$self{OPTIONS}{Binary} or $$self{EXCL_TAG_LOOKUP}{$lcTag}) and
9723
- not $$self{OPTIONS}{Verbose} and not $$self{REQ_TAG_LOOKUP}{$lcTag})
9722
+ my $options = $$self{OPTIONS};
9723
+ if ((not $$options{Binary} or $$self{EXCL_TAG_LOOKUP}{$lcTag}) and
9724
+ not $$options{Verbose} and not $$options{Validate} and
9725
+ not $$self{REQ_TAG_LOOKUP}{$lcTag})
9724
9726
  {
9725
9727
  return "Binary data $length bytes";
9726
9728
  }
@@ -1,6 +1,6 @@
1
1
  Summary: perl module for image data extraction
2
2
  Name: perl-Image-ExifTool
3
- Version: 13.30
3
+ Version: 13.31
4
4
  Release: 1
5
5
  License: Artistic/GPL
6
6
  Group: Development/Libraries/Perl