| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
#------------------------------------------------------------------------------ |
|
2
|
|
|
|
|
|
|
# File: PrintIM.pm |
|
3
|
|
|
|
|
|
|
# |
|
4
|
|
|
|
|
|
|
# Description: Read PrintIM meta information |
|
5
|
|
|
|
|
|
|
# |
|
6
|
|
|
|
|
|
|
# Revisions: 04/07/2004 - P. Harvey Created |
|
7
|
|
|
|
|
|
|
#------------------------------------------------------------------------------ |
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
package Image::ExifTool::PrintIM; |
|
10
|
|
|
|
|
|
|
|
|
11
|
18
|
|
|
18
|
|
169
|
use strict; |
|
|
18
|
|
|
|
|
229
|
|
|
|
18
|
|
|
|
|
734
|
|
|
12
|
18
|
|
|
18
|
|
232
|
use vars qw($VERSION); |
|
|
18
|
|
|
|
|
61
|
|
|
|
18
|
|
|
|
|
1026
|
|
|
13
|
18
|
|
|
18
|
|
123
|
use Image::ExifTool qw(:DataAccess); |
|
|
18
|
|
|
|
|
35
|
|
|
|
18
|
|
|
|
|
11661
|
|
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
$VERSION = '1.07'; |
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub ProcessPrintIM($$$); |
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
# PrintIM table (proprietary specification by Epson) |
|
20
|
|
|
|
|
|
|
%Image::ExifTool::PrintIM::Main = ( |
|
21
|
|
|
|
|
|
|
PROCESS_PROC => \&ProcessPrintIM, |
|
22
|
|
|
|
|
|
|
GROUPS => { 0 => 'PrintIM', 1 => 'PrintIM', 2 => 'Printing' }, |
|
23
|
|
|
|
|
|
|
PRINT_CONV => 'sprintf("0x%.8x", $val)', |
|
24
|
|
|
|
|
|
|
TAG_PREFIX => 'PrintIM', |
|
25
|
|
|
|
|
|
|
PrintIMVersion => { # values: 0100, 0250, 0260, 0300 |
|
26
|
|
|
|
|
|
|
Description => 'PrintIM Version', |
|
27
|
|
|
|
|
|
|
PrintConv => undef, |
|
28
|
|
|
|
|
|
|
}, |
|
29
|
|
|
|
|
|
|
# the following names are from http://www.kanzaki.com/ns/exif |
|
30
|
|
|
|
|
|
|
# but the decoding is unknown: |
|
31
|
|
|
|
|
|
|
# 9 => { Name => 'PIMContrast', Unknown => 1 }, #1 |
|
32
|
|
|
|
|
|
|
# 10 => { Name => 'PIMBrightness', Unknown => 1 }, #1 |
|
33
|
|
|
|
|
|
|
# 11 => { Name => 'PIMColorbalance', Unknown => 1 }, #1 |
|
34
|
|
|
|
|
|
|
# 12 => { Name => 'PIMSaturation', Unknown => 1 }, #1 |
|
35
|
|
|
|
|
|
|
# 13 => { Name => 'PIMSharpness', Unknown => 1 }, #1 |
|
36
|
|
|
|
|
|
|
); |
|
37
|
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
#------------------------------------------------------------------------------ |
|
40
|
|
|
|
|
|
|
# Process PrintIM IFD |
|
41
|
|
|
|
|
|
|
# Inputs: 0) ExifTool object ref, 1) dirInfo ref, 2) tag table ref |
|
42
|
|
|
|
|
|
|
# Returns: 1 on success |
|
43
|
|
|
|
|
|
|
sub ProcessPrintIM($$$) |
|
44
|
|
|
|
|
|
|
{ |
|
45
|
63
|
|
|
63
|
0
|
238
|
my ($et, $dirInfo, $tagTablePtr) = @_; |
|
46
|
63
|
|
|
|
|
180
|
my $dataPt = $$dirInfo{DataPt}; |
|
47
|
63
|
|
|
|
|
169
|
my $offset = $$dirInfo{DirStart}; |
|
48
|
63
|
|
|
|
|
166
|
my $size = $$dirInfo{DirLen}; |
|
49
|
63
|
|
|
|
|
268
|
my $verbose = $et->Options('Verbose'); |
|
50
|
|
|
|
|
|
|
|
|
51
|
63
|
50
|
|
|
|
347
|
unless ($size) { |
|
52
|
0
|
|
|
|
|
0
|
$et->Warn('Empty PrintIM data', 1); |
|
53
|
0
|
|
|
|
|
0
|
return 0; |
|
54
|
|
|
|
|
|
|
} |
|
55
|
63
|
50
|
|
|
|
260
|
unless ($size > 15) { |
|
56
|
0
|
|
|
|
|
0
|
$et->Warn('Bad PrintIM data'); |
|
57
|
0
|
|
|
|
|
0
|
return 0; |
|
58
|
|
|
|
|
|
|
} |
|
59
|
63
|
50
|
|
|
|
394
|
unless (substr($$dataPt, $offset, 7) eq 'PrintIM') { |
|
60
|
0
|
|
|
|
|
0
|
$et->Warn('Invalid PrintIM header'); |
|
61
|
0
|
|
|
|
|
0
|
return 0; |
|
62
|
|
|
|
|
|
|
} |
|
63
|
|
|
|
|
|
|
# check size of PrintIM block |
|
64
|
63
|
|
|
|
|
278
|
my $num = Get16u($dataPt, $offset + 14); |
|
65
|
63
|
100
|
|
|
|
355
|
if ($size < 16 + $num * 6) { |
|
66
|
|
|
|
|
|
|
# size is too big, maybe byte ordering is wrong |
|
67
|
1
|
|
|
|
|
6
|
ToggleByteOrder(); |
|
68
|
1
|
|
|
|
|
6
|
$num = Get16u($dataPt, $offset + 14); |
|
69
|
1
|
50
|
|
|
|
21
|
if ($size < 16 + $num * 6) { |
|
70
|
0
|
|
|
|
|
0
|
$et->Warn('Bad PrintIM size'); |
|
71
|
0
|
|
|
|
|
0
|
return 0; |
|
72
|
|
|
|
|
|
|
} |
|
73
|
|
|
|
|
|
|
} |
|
74
|
63
|
100
|
|
|
|
223
|
$verbose and $et->VerboseDir('PrintIM', $num); |
|
75
|
63
|
|
|
|
|
552
|
$et->HandleTag($tagTablePtr, 'PrintIMVersion', substr($$dataPt, $offset + 8, 4), |
|
76
|
|
|
|
|
|
|
DataPt => $dataPt, |
|
77
|
|
|
|
|
|
|
Start => $offset + 8, |
|
78
|
|
|
|
|
|
|
Size => 4, |
|
79
|
|
|
|
|
|
|
); |
|
80
|
63
|
|
|
|
|
171
|
my $n; |
|
81
|
63
|
|
|
|
|
292
|
for ($n=0; $n<$num; ++$n) { |
|
82
|
629
|
|
|
|
|
1159
|
my $pos = $offset + 16 + $n * 6; |
|
83
|
629
|
|
|
|
|
1354
|
my $tag = Get16u($dataPt, $pos); |
|
84
|
629
|
|
|
|
|
1946
|
my $val = Get32u($dataPt, $pos + 2); |
|
85
|
629
|
|
|
|
|
1896
|
$et->HandleTag($tagTablePtr, $tag, $val, |
|
86
|
|
|
|
|
|
|
Index => $n, |
|
87
|
|
|
|
|
|
|
DataPt => $dataPt, |
|
88
|
|
|
|
|
|
|
Start => $pos + 2, |
|
89
|
|
|
|
|
|
|
Size => 4, |
|
90
|
|
|
|
|
|
|
); |
|
91
|
|
|
|
|
|
|
} |
|
92
|
63
|
|
|
|
|
274
|
return 1; |
|
93
|
|
|
|
|
|
|
} |
|
94
|
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
1; # end |
|
97
|
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
__END__ |