/usr/share/perl5/Image/ExifTool/MPF.pm is in libimage-exiftool-perl 8.60-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 | #------------------------------------------------------------------------------
# File: MPF.pm
#
# Description: Read Multi-Picture Format information
#
# Revisions: 06/12/2009 - P. Harvey Created
#
# References: 1) http://www.cipa.jp/english/hyoujunka/kikaku/pdf/DC-007_E.pdf
#------------------------------------------------------------------------------
package Image::ExifTool::MPF;
use strict;
use vars qw($VERSION);
use Image::ExifTool qw(:DataAccess :Utils);
use Image::ExifTool::Exif;
$VERSION = '1.05';
sub ProcessMPImageList($$$);
# Tags found in MPF APP2 segment in JPEG images
%Image::ExifTool::MPF::Main = (
GROUPS => { 0 => 'MPF', 1 => 'MPF0', 2 => 'Image'},
NOTES => q{
These tags are part of the CIPA Multi-Picture Format specification, and are
found in the APP2 "MPF" segment of JPEG images. See
L<http://www.cipa.jp/english/hyoujunka/kikaku/pdf/DC-007_E.pdf> for the
official specification.
},
0xb000 => 'MPFVersion',
0xb001 => 'NumberOfImages',
0xb002 => {
Name => 'MPImageList',
SubDirectory => {
TagTable => 'Image::ExifTool::MPF::MPImage',
ProcessProc => \&ProcessMPImageList,
},
},
0xb003 => {
Name => 'ImageUIDList',
Binary => 1,
},
0xb004 => 'TotalFrames',
0xb101 => 'MPIndividualNum',
0xb201 => {
Name => 'PanOrientation',
PrintHex => 1,
Notes => 'long integer is split into 4 bytes',
ValueConv => 'join(" ",unpack("C*",pack("N",$val)))',
PrintConv => [
'"$val rows"',
'"$val columns"',
{
0 => '[unused]',
1 => 'Start at top right',
2 => 'Start at top left',
3 => 'Start at bottom left',
4 => 'Start at bottom right',
},
{
0x01 => 'Left to right',
0x02 => 'Right to left',
0x03 => 'Top to bottom',
0x04 => 'Bottom to top',
0x10 => 'Clockwise',
0x20 => 'Counter clockwise',
0x30 => 'Zigzag (row start)',
0x40 => 'Zigzag (column start)',
},
],
},
0xb202 => 'PanOverlapH',
0xb203 => 'PanOverlapV',
0xb204 => 'BaseViewpointNum',
0xb205 => 'ConvergenceAngle',
0xb206 => 'BaselineLength',
0xb207 => 'VerticalDivergence',
0xb208 => 'AxisDistanceX',
0xb209 => 'AxisDistanceY',
0xb20a => 'AxisDistanceZ',
0xb20b => 'YawAngle',
0xb20c => 'PitchAngle',
0xb20d => 'RollAngle',
);
# Tags found in MPImage structure
%Image::ExifTool::MPF::MPImage = (
PROCESS_PROC => \&Image::ExifTool::ProcessBinaryData,
#WRITE_PROC => \&Image::ExifTool::WriteBinaryData,
#CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
#WRITABLE => 1,
GROUPS => { 0 => 'MPF', 1 => 'MPImage', 2 => 'Image'},
NOTES => q{
The first MPF "Large Thumbnail" image is extracted as PreviewImage, and the
rest of the embedded MPF images are extracted as MPImage#. The
ExtractEmbedded (-ee) option may be used to extract information from these
embedded images.
},
0.1 => {
Name => 'MPImageFlags',
Format => 'int32u',
Mask => 0xf8000000,
PrintConv => { BITMASK => {
29 => 'Representative image',
30 => 'Dependent child image',
31 => 'Dependent parent image',
}},
},
0.2 => {
Name => 'MPImageFormat',
Format => 'int32u',
Mask => 0x07000000,
PrintConv => {
0 => 'JPEG',
},
},
0.3 => {
Name => 'MPImageType',
Format => 'int32u',
Mask => 0x00ffffff,
PrintHex => 1,
PrintConv => {
0x000000 => 'Undefined',
0x010001 => 'Large Thumbnail (VGA equivalent)',
0x010002 => 'Large Thumbnail (full HD equivalent)',
0x020001 => 'Multi-frame Panorama',
0x020002 => 'Multi-frame Disparity',
0x020003 => 'Multi-angle',
0x030000 => 'Baseline MP Primary Image',
},
},
4 => {
Name => 'MPImageLength',
Format => 'int32u',
},
8 => {
Name => 'MPImageStart',
Format => 'int32u',
IsOffset => '$val',
},
12 => {
Name => 'DependentImage1EntryNumber',
Format => 'int16u',
},
14 => {
Name => 'DependentImage2EntryNumber',
Format => 'int16u',
},
);
# extract MP Images as composite tags
%Image::ExifTool::MPF::Composite = (
GROUPS => { 2 => 'Image' },
MPImage => {
Require => {
0 => 'MPImageStart',
1 => 'MPImageLength',
2 => 'MPImageType',
},
Notes => q{
the first MPF "Large Thumbnail" is extracted as PreviewImage, and the rest
of the embedded MPF images are extracted as MPImage#. The ExtractEmbedded
option may be used to extract information from these embedded images.
},
# extract all MPF images (not just one)
RawConv => q{
require Image::ExifTool::MPF;
Image::ExifTool::MPF::ExtractMPImages($self);
},
},
);
# add our composite tags
Image::ExifTool::AddCompositeTags('Image::ExifTool::MPF');
#------------------------------------------------------------------------------
# Extract all MP images
# Inputs: 0) ExifTool object ref
# Returns: undef
sub ExtractMPImages($)
{
my $exifTool = shift;
my $ee = $exifTool->Options('ExtractEmbedded');
my $saveBinary = $exifTool->Options('Binary');
my ($i, $didPreview, $xtra);
for ($i=1; $xtra or not defined $xtra; ++$i) {
# run through MP images in the same order they were extracted
$xtra = defined $$exifTool{VALUE}{"MPImageStart ($i)"} ? " ($i)" : '';
my $off = $exifTool->GetValue("MPImageStart$xtra");
my $len = $exifTool->GetValue("MPImageLength$xtra");
if ($off and $len) {
my $type = $exifTool->GetValue("MPImageType$xtra", 'ValueConv');
my $tag = "MPImage$i";
# store first "Large Thumbnail" as a PreviewImage
if (not $didPreview and $type and ($type & 0x0f0000) == 0x010000) {
$tag = 'PreviewImage';
$didPreview = 1;
}
$exifTool->Options('Binary', 1) if $ee;
my $val = Image::ExifTool::Exif::ExtractImage($exifTool, $off, $len, $tag);
$exifTool->Options('Binary', $saveBinary) if $ee;
next unless defined $val;
unless ($Image::ExifTool::Extra{$tag}) {
Image::ExifTool::AddTagToTable(\%Image::ExifTool::Extra, $tag, {
Name => $tag,
Groups => { 0 => 'Composite', 1 => 'Composite', 2 => 'Image'},
});
}
my $key = $exifTool->FoundTag($tag, $val);
# set groups for PreviewImage
if ($tag eq 'PreviewImage') {
$exifTool->SetGroup($key, 'Composite', 0);
$exifTool->SetGroup($key, 'Composite');
}
# extract information from MP images if ExtractEmbedded option used
if ($ee) {
$$exifTool{DOC_NUM} = $i;
$exifTool->ExtractInfo($val, { ReEntry => 1 });
delete $$exifTool{DOC_NUM};
}
}
}
return undef;
}
#------------------------------------------------------------------------------
# Process MP Entry list
# Inputs: 0) ExifTool object ref, 1) dirInfo ref, 2) tag table ref
# Returns: 1 on success
sub ProcessMPImageList($$$)
{
my ($exifTool, $dirInfo, $tagTablePtr) = @_;
my $num = int($$dirInfo{DirLen} / 16); # (16 bytes per MP Entry)
$$dirInfo{DirLen} = 16;
my ($i, $success);
my $oldG1 = $$exifTool{SET_GROUP1};
for ($i=0; $i<$num; ++$i) {
$$exifTool{SET_GROUP1} = '+' . ($i + 1);
$success = $exifTool->ProcessBinaryData($dirInfo, $tagTablePtr);
$$dirInfo{DirStart} += 16;
}
$$exifTool{SET_GROUP1} = $oldG1;
return $success;
}
1; # end
__END__
=head1 NAME
Image::ExifTool::MPF - Read Multi-Picture Format information
=head1 SYNOPSIS
This module is used by Image::ExifTool
=head1 DESCRIPTION
This module contains tag definitions and routines to read Multi-Picture
Format (MPF) information from JPEG images.
=head1 AUTHOR
Copyright 2003-2011, Phil Harvey (phil at owl.phy.queensu.ca)
This library is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.
=head1 REFERENCES
=over 4
=item L<http://www.cipa.jp/english/hyoujunka/kikaku/pdf/DC-007_E.pdf>
=back
=head1 SEE ALSO
L<Image::ExifTool::TagNames/MPF Tags>,
L<Image::ExifTool(3pm)|Image::ExifTool>
=cut
|