| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
#------------------------------------------------------------------------------ |
|
2
|
|
|
|
|
|
|
# File: PCX.pm |
|
3
|
|
|
|
|
|
|
# |
|
4
|
|
|
|
|
|
|
# Description: Read metadata from PC Paintbrush files |
|
5
|
|
|
|
|
|
|
# |
|
6
|
|
|
|
|
|
|
# Revisions: 2018/12/12 - P. Harvey Created |
|
7
|
|
|
|
|
|
|
# |
|
8
|
|
|
|
|
|
|
# References: 1) http://qzx.com/pc-gpe/pcx.txt |
|
9
|
|
|
|
|
|
|
# 2) https://www.fileformat.info/format/pcx/corion.htm |
|
10
|
|
|
|
|
|
|
#------------------------------------------------------------------------------ |
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
package Image::ExifTool::PCX; |
|
13
|
|
|
|
|
|
|
|
|
14
|
1
|
|
|
1
|
|
3407
|
use strict; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
27
|
|
|
15
|
1
|
|
|
1
|
|
4
|
use vars qw($VERSION); |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
32
|
|
|
16
|
1
|
|
|
1
|
|
4
|
use Image::ExifTool qw(:DataAccess :Utils); |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
464
|
|
|
17
|
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
$VERSION = '1.00'; |
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
# PCX info |
|
21
|
|
|
|
|
|
|
%Image::ExifTool::PCX::Main = ( |
|
22
|
|
|
|
|
|
|
PROCESS_PROC => \&Image::ExifTool::ProcessBinaryData, |
|
23
|
|
|
|
|
|
|
GROUPS => { 0 => 'File', 1 => 'File', 2 => 'Image' }, |
|
24
|
|
|
|
|
|
|
NOTES => 'Tags extracted from PC Paintbrush images.', |
|
25
|
|
|
|
|
|
|
DATAMEMBER => [ 0x04, 0x05 ], |
|
26
|
|
|
|
|
|
|
0x00 => { |
|
27
|
|
|
|
|
|
|
Name => 'Manufacturer', |
|
28
|
|
|
|
|
|
|
PrintConv => { 10 => 'ZSoft' }, |
|
29
|
|
|
|
|
|
|
}, |
|
30
|
|
|
|
|
|
|
0x01 => { |
|
31
|
|
|
|
|
|
|
Name => 'Software', |
|
32
|
|
|
|
|
|
|
PrintConv => { |
|
33
|
|
|
|
|
|
|
0 => 'PC Paintbrush 2.5', |
|
34
|
|
|
|
|
|
|
2 => 'PC Paintbrush 2.8 (with palette)', |
|
35
|
|
|
|
|
|
|
3 => 'PC Paintbrush 2.8 (without palette)', |
|
36
|
|
|
|
|
|
|
4 => 'PC Paintbrush for Windows', |
|
37
|
|
|
|
|
|
|
5 => 'PC Paintbrush 3.0+', |
|
38
|
|
|
|
|
|
|
}, |
|
39
|
|
|
|
|
|
|
}, |
|
40
|
|
|
|
|
|
|
0x02 => { Name => 'Encoding', PrintConv => { 1 => 'RLE' } }, |
|
41
|
|
|
|
|
|
|
0x03 => 'BitsPerPixel', |
|
42
|
|
|
|
|
|
|
0x04 => { |
|
43
|
|
|
|
|
|
|
Name => 'LeftMargin', |
|
44
|
|
|
|
|
|
|
Format => 'int16u', |
|
45
|
|
|
|
|
|
|
RawConv => '$$self{LeftMargin} = $val', |
|
46
|
|
|
|
|
|
|
}, |
|
47
|
|
|
|
|
|
|
0x06 => { |
|
48
|
|
|
|
|
|
|
Name => 'TopMargin', |
|
49
|
|
|
|
|
|
|
Format => 'int16u', |
|
50
|
|
|
|
|
|
|
RawConv => '$$self{TopMargin} = $val', |
|
51
|
|
|
|
|
|
|
}, |
|
52
|
|
|
|
|
|
|
0x08 => { |
|
53
|
|
|
|
|
|
|
Name => 'ImageWidth', |
|
54
|
|
|
|
|
|
|
Format => 'int16u', |
|
55
|
|
|
|
|
|
|
Notes => 'adjusted for LeftMargin', |
|
56
|
|
|
|
|
|
|
ValueConv => '$val - $$self{LeftMargin} + 1', |
|
57
|
|
|
|
|
|
|
}, |
|
58
|
|
|
|
|
|
|
0x0a => { |
|
59
|
|
|
|
|
|
|
Name => 'ImageHeight', |
|
60
|
|
|
|
|
|
|
Format => 'int16u', |
|
61
|
|
|
|
|
|
|
Notes => 'adjusted for TopMargin', |
|
62
|
|
|
|
|
|
|
ValueConv => '$val - $$self{TopMargin} + 1', |
|
63
|
|
|
|
|
|
|
}, |
|
64
|
|
|
|
|
|
|
0x0c => 'XResolution', |
|
65
|
|
|
|
|
|
|
0x0e => 'YResolution', |
|
66
|
|
|
|
|
|
|
0x41 => 'ColorPlanes', |
|
67
|
|
|
|
|
|
|
0x42 => { Name => 'BytesPerLine', Format => 'int16u' }, |
|
68
|
|
|
|
|
|
|
0x44 => { |
|
69
|
|
|
|
|
|
|
Name => 'ColorMode', |
|
70
|
|
|
|
|
|
|
PrintConv => { |
|
71
|
|
|
|
|
|
|
0 => 'n/a', |
|
72
|
|
|
|
|
|
|
1 => 'Color Palette', |
|
73
|
|
|
|
|
|
|
2 => 'Grayscale', |
|
74
|
|
|
|
|
|
|
}, |
|
75
|
|
|
|
|
|
|
}, |
|
76
|
|
|
|
|
|
|
0x46 => { Name => 'ScreenWidth', Format => 'int16u', RawConv => '$val or undef' }, |
|
77
|
|
|
|
|
|
|
0x48 => { Name => 'ScreenHeight', Format => 'int16u', RawConv => '$val or undef' }, |
|
78
|
|
|
|
|
|
|
); |
|
79
|
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
#------------------------------------------------------------------------------ |
|
81
|
|
|
|
|
|
|
# Extract information from a PCX image |
|
82
|
|
|
|
|
|
|
# Inputs: 0) ExifTool object reference, 1) dirInfo reference |
|
83
|
|
|
|
|
|
|
# Returns: 1 on success, 0 if this wasn't a valid PCX file |
|
84
|
|
|
|
|
|
|
sub ProcessPCX($$) |
|
85
|
|
|
|
|
|
|
{ |
|
86
|
1
|
|
|
1
|
0
|
3
|
my ($et, $dirInfo) = @_; |
|
87
|
1
|
|
|
|
|
2
|
my $raf = $$dirInfo{RAF}; |
|
88
|
1
|
|
|
|
|
2
|
my $buff; |
|
89
|
1
|
50
|
33
|
|
|
4
|
return 0 unless $raf->Read($buff, 0x50) == 0x50 and |
|
90
|
|
|
|
|
|
|
$buff =~ /^\x0a[\0-\x05]\x01[\x01\x02\x04\x08].{64}[\0-\x02]/s; |
|
91
|
1
|
|
|
|
|
5
|
SetByteOrder('II'); |
|
92
|
1
|
|
|
|
|
6
|
$et->SetFileType(); |
|
93
|
1
|
|
|
|
|
6
|
my %dirInfo = ( DirName => 'PCX', DataPt => \$buff ); |
|
94
|
1
|
|
|
|
|
4
|
my $tagTablePtr = GetTagTable('Image::ExifTool::PCX::Main'); |
|
95
|
1
|
|
|
|
|
6
|
return $et->ProcessBinaryData(\%dirInfo, $tagTablePtr); |
|
96
|
|
|
|
|
|
|
} |
|
97
|
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
1; # end |
|
99
|
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
__END__ |