/usr/share/perl5/Image/ExifTool/PGF.pm is in libimage-exiftool-perl 10.40-1.
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 | #------------------------------------------------------------------------------
# File: PGF.pm
#
# Description: Read Progressive Graphics File meta information
#
# Revisions: 2011/01/25 - P. Harvey Created
#
# References: 1) http://www.libpgf.org/
# 2) http://www.exiv2.org/
#------------------------------------------------------------------------------
package Image::ExifTool::PGF;
use strict;
use vars qw($VERSION);
use Image::ExifTool qw(:DataAccess :Utils);
$VERSION = '1.02';
# PGF header information
%Image::ExifTool::PGF::Main = (
GROUPS => { 0 => 'File', 1 => 'File', 2 => 'Image' },
PROCESS_PROC => \&Image::ExifTool::ProcessBinaryData,
PRIORITY => 2, # (to take precedence over PNG tags from embedded image)
NOTES => q{
The following table lists information extracted from the header of
Progressive Graphics File (PGF) images. As well, information is extracted
from the embedded PNG metadata image if it exists. See
L<http://www.libpgf.org/> for the PGF specification.
},
3 => {
Name => 'PGFVersion',
PrintConv => 'sprintf("0x%.2x", $val)',
# this is actually a bitmask (ref digikam PGFtypes.h):
# 0x02 - data structure PGFHeader of major version 2
# 0x04 - 32-bit values
# 0x08 - supports regions of interest
# 0x10 - new coding scheme since major version 5
# 0x20 - new HeaderSize: 32 bits instead of 16 bits
},
8 => { Name => 'ImageWidth', Format => 'int32u' },
12 => { Name => 'ImageHeight', Format => 'int32u' },
16 => 'PyramidLevels',
17 => 'Quality',
18 => 'BitsPerPixel',
19 => 'ColorComponents',
20 => {
Name => 'ColorMode',
RawConv => '$$self{PGFColorMode} = $val',
PrintConvColumns => 2,
PrintConv => {
0 => 'Bitmap',
1 => 'Grayscale',
2 => 'Indexed',
3 => 'RGB',
4 => 'CMYK',
7 => 'Multichannel',
8 => 'Duotone',
9 => 'Lab',
},
},
21 => { Name => 'BackgroundColor', Format => 'int8u[3]' },
);
#------------------------------------------------------------------------------
# Extract information from a PGF image
# Inputs: 0) ExifTool object reference, 1) dirInfo reference
# Returns: 1 on success, 0 if this wasn't a valid PGF file
sub ProcessPGF($$)
{
my ($et, $dirInfo) = @_;
my $raf = $$dirInfo{RAF};
my $buff;
# read header and check magic number
return 0 unless $raf->Read($buff, 24) == 24 and $buff =~ /^PGF(.)/s;
my $ver = ord $1;
$et->SetFileType();
SetByteOrder('II');
# currently support only version 0x36
unless ($ver == 0x36) {
$et->Error(sprintf('Unsupported PGF version 0x%.2x', $ver));
return 1;
}
# extract information from the PGF header
my $tagTablePtr = GetTagTable('Image::ExifTool::PGF::Main');
$et->ProcessDirectory({ DataPt => \$buff, DataPos => 0 }, $tagTablePtr);
my $len = Get32u(\$buff, 4) - 16; # length of post-header data
# skip colour table if necessary
$len -= $raf->Seek(1024, 1) ? 1024 : $len if $$et{PGFColorMode} == 2;
# extract information from the embedded metadata image (PNG format)
if ($len > 0 and $len < 0x1000000 and $raf->Read($buff, $len) == $len) {
$et->ExtractInfo(\$buff, { ReEntry => 1 });
}
return 1;
}
1; # end
__END__
=head1 NAME
Image::ExifTool::PGF - Read Progressive Graphics File meta information
=head1 SYNOPSIS
This module is used by Image::ExifTool
=head1 DESCRIPTION
This module contains definitions required by Image::ExifTool to extract meta
information from Progressive Graphics File (PGF) images.
=head1 AUTHOR
Copyright 2003-2017, 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.libpgf.org/>
=item L<http://www.exiv2.org/>
=back
=head1 SEE ALSO
L<Image::ExifTool::TagNames/PGF Tags>,
L<Image::ExifTool(3pm)|Image::ExifTool>
=cut
|