- Timestamp:
- 2021-02-26T19:39:51+13:00 (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/greenstone2/perllib/cpan/Image/ExifTool/MPF.pm
r24107 r34921 6 6 # Revisions: 06/12/2009 - P. Harvey Created 7 7 # 8 # References: 1) http://www.cipa.jp/ english/hyoujunka/kikaku/pdf/DC-007_E.pdf8 # References: 1) http://www.cipa.jp/std/documents/e/DC-007_E.pdf 9 9 #------------------------------------------------------------------------------ 10 10 … … 16 16 use Image::ExifTool::Exif; 17 17 18 $VERSION = '1. 05';18 $VERSION = '1.14'; 19 19 20 20 sub ProcessMPImageList($$$); 21 21 22 # Tags found in MPF APP2segment in JPEG images22 # Tags found in APP2 MPF segment in JPEG images 23 23 %Image::ExifTool::MPF::Main = ( 24 24 GROUPS => { 0 => 'MPF', 1 => 'MPF0', 2 => 'Image'}, 25 25 NOTES => q{ 26 26 These tags are part of the CIPA Multi-Picture Format specification, and are 27 found in the APP2 "MPF" segment of JPEG images. See 28 L<http://www.cipa.jp/english/hyoujunka/kikaku/pdf/DC-007_E.pdf> for the 29 official specification. 27 found in the APP2 "MPF" segment of JPEG images. MPImage data referenced 28 from this segment is stored as a JPEG trailer. The MPF tags are not 29 writable, however the MPF segment may be deleted as a group (with "MPF:All") 30 but then the JPEG trailer should also be deleted (with "Trailer:All"). See 31 L<https://web.archive.org/web/20190713230858/http://www.cipa.jp/std/documents/e/DC-007_E.pdf> 32 for the official specification. 30 33 }, 31 34 0xb000 => 'MPFVersion', … … 70 73 }, 71 74 ], 72 }, 75 }, 73 76 0xb202 => 'PanOverlapH', 74 77 0xb203 => 'PanOverlapV', … … 95 98 The first MPF "Large Thumbnail" image is extracted as PreviewImage, and the 96 99 rest of the embedded MPF images are extracted as MPImage#. The 97 ExtractEmbedded(-ee) option may be used to extract information from these100 L<ExtractEmbedded|../ExifTool.html#ExtractEmbedded> (-ee) option may be used to extract information from these 98 101 embedded images. 99 102 }, … … 103 106 Mask => 0xf8000000, 104 107 PrintConv => { BITMASK => { 105 2 9=> 'Representative image',106 3 0=> 'Dependent child image',107 31=> 'Dependent parent image',108 2 => 'Representative image', 109 3 => 'Dependent child image', 110 4 => 'Dependent parent image', 108 111 }}, 109 112 }, … … 152 155 # extract MP Images as composite tags 153 156 %Image::ExifTool::MPF::Composite = ( 154 GROUPS => { 2 => ' Image' },157 GROUPS => { 2 => 'Preview' }, 155 158 MPImage => { 156 159 Require => { … … 161 164 Notes => q{ 162 165 the first MPF "Large Thumbnail" is extracted as PreviewImage, and the rest 163 of the embedded MPF images are extracted as MPImage#. The ExtractEmbedded166 of the embedded MPF images are extracted as MPImage#. The L<ExtractEmbedded|../ExifTool.html#ExtractEmbedded> 164 167 option may be used to extract information from these embedded images. 165 168 }, … … 167 170 RawConv => q{ 168 171 require Image::ExifTool::MPF; 172 @grps = $self->GetGroup($$val{0}); # set groups from input tag 169 173 Image::ExifTool::MPF::ExtractMPImages($self); 170 174 }, … … 181 185 sub ExtractMPImages($) 182 186 { 183 my $e xifTool= shift;184 my $ee = $e xifTool->Options('ExtractEmbedded');185 my $saveBinary = $e xifTool->Options('Binary');187 my $et = shift; 188 my $ee = $et->Options('ExtractEmbedded'); 189 my $saveBinary = $et->Options('Binary'); 186 190 my ($i, $didPreview, $xtra); 187 191 188 192 for ($i=1; $xtra or not defined $xtra; ++$i) { 189 193 # run through MP images in the same order they were extracted 190 $xtra = defined $$e xifTool{VALUE}{"MPImageStart ($i)"} ? " ($i)" : '';191 my $off = $e xifTool->GetValue("MPImageStart$xtra");192 my $len = $e xifTool->GetValue("MPImageLength$xtra");194 $xtra = defined $$et{VALUE}{"MPImageStart ($i)"} ? " ($i)" : ''; 195 my $off = $et->GetValue("MPImageStart$xtra", 'ValueConv'); 196 my $len = $et->GetValue("MPImageLength$xtra", 'ValueConv'); 193 197 if ($off and $len) { 194 my $type = $e xifTool->GetValue("MPImageType$xtra", 'ValueConv');198 my $type = $et->GetValue("MPImageType$xtra", 'ValueConv'); 195 199 my $tag = "MPImage$i"; 196 200 # store first "Large Thumbnail" as a PreviewImage … … 199 203 $didPreview = 1; 200 204 } 201 $e xifTool->Options('Binary', 1) if $ee;202 my $val = Image::ExifTool::Exif::ExtractImage($e xifTool, $off, $len, $tag);203 $e xifTool->Options('Binary', $saveBinary) if $ee;205 $et->Options('Binary', 1) if $ee; 206 my $val = Image::ExifTool::Exif::ExtractImage($et, $off, $len, $tag); 207 $et->Options('Binary', $saveBinary) if $ee; 204 208 next unless defined $val; 205 209 unless ($Image::ExifTool::Extra{$tag}) { 206 Image::ExifTool::AddTagToTable(\%Image::ExifTool::Extra, $tag, {210 AddTagToTable(\%Image::ExifTool::Extra, $tag, { 207 211 Name => $tag, 208 Groups => { 0 => 'Composite', 1 => 'Composite', 2 => ' Image'},212 Groups => { 0 => 'Composite', 1 => 'Composite', 2 => 'Preview'}, 209 213 }); 210 214 } 211 my $key = $exifTool->FoundTag($tag, $val); 212 # set groups for PreviewImage 213 if ($tag eq 'PreviewImage') { 214 $exifTool->SetGroup($key, 'Composite', 0); 215 $exifTool->SetGroup($key, 'Composite'); 216 } 215 my $key = $et->FoundTag($tag, $val, $et->GetGroup("MPImageStart$xtra")); 217 216 # extract information from MP images if ExtractEmbedded option used 218 217 if ($ee) { 219 $$exifTool{DOC_NUM} = $i; 220 $exifTool->ExtractInfo($val, { ReEntry => 1 }); 221 delete $$exifTool{DOC_NUM}; 218 my $oldBase = $$et{BASE}; 219 $$et{BASE} = $off; 220 $$et{DOC_NUM} = $i; 221 $et->ExtractInfo($val, { ReEntry => 1 }); 222 delete $$et{DOC_NUM}; 223 $$et{BASE} = $oldBase; 222 224 } 223 225 } … … 232 234 sub ProcessMPImageList($$$) 233 235 { 234 my ($e xifTool, $dirInfo, $tagTablePtr) = @_;236 my ($et, $dirInfo, $tagTablePtr) = @_; 235 237 my $num = int($$dirInfo{DirLen} / 16); # (16 bytes per MP Entry) 236 238 $$dirInfo{DirLen} = 16; 237 239 my ($i, $success); 238 my $oldG1 = $$e xifTool{SET_GROUP1};240 my $oldG1 = $$et{SET_GROUP1}; 239 241 for ($i=0; $i<$num; ++$i) { 240 $$e xifTool{SET_GROUP1} = '+' . ($i + 1);241 $success = $e xifTool->ProcessBinaryData($dirInfo, $tagTablePtr);242 $$et{SET_GROUP1} = '+' . ($i + 1); 243 $success = $et->ProcessBinaryData($dirInfo, $tagTablePtr); 242 244 $$dirInfo{DirStart} += 16; 243 245 } 244 $$e xifTool{SET_GROUP1} = $oldG1;246 $$et{SET_GROUP1} = $oldG1; 245 247 return $success; 246 248 } … … 265 267 =head1 AUTHOR 266 268 267 Copyright 2003-20 11, Phil Harvey (phil at owl.phy.queensu.ca)269 Copyright 2003-2021, Phil Harvey (philharvey66 at gmail.com) 268 270 269 271 This library is free software; you can redistribute it and/or modify it … … 274 276 =over 4 275 277 276 =item L<http://www.cipa.jp/ english/hyoujunka/kikaku/pdf/DC-007_E.pdf>278 =item L<http://www.cipa.jp/std/documents/e/DC-007_E.pdf> 277 279 278 280 =back
Note:
See TracChangeset
for help on using the changeset viewer.