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
|
|
146
|
use strict; |
|
18
|
|
|
|
|
52
|
|
|
18
|
|
|
|
|
744
|
|
12
|
18
|
|
|
18
|
|
122
|
use vars qw($VERSION); |
|
18
|
|
|
|
|
40
|
|
|
18
|
|
|
|
|
1072
|
|
13
|
18
|
|
|
18
|
|
129
|
use Image::ExifTool qw(:DataAccess); |
|
18
|
|
|
|
|
40
|
|
|
18
|
|
|
|
|
11722
|
|
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
|
67
|
|
|
67
|
0
|
304
|
my ($et, $dirInfo, $tagTablePtr) = @_; |
46
|
67
|
|
|
|
|
192
|
my $dataPt = $$dirInfo{DataPt}; |
47
|
67
|
|
|
|
|
170
|
my $offset = $$dirInfo{DirStart}; |
48
|
67
|
|
|
|
|
165
|
my $size = $$dirInfo{DirLen}; |
49
|
67
|
|
|
|
|
271
|
my $verbose = $et->Options('Verbose'); |
50
|
|
|
|
|
|
|
|
51
|
67
|
50
|
|
|
|
452
|
unless ($size) { |
52
|
0
|
|
|
|
|
0
|
$et->Warn('Empty PrintIM data', 1); |
53
|
0
|
|
|
|
|
0
|
return 0; |
54
|
|
|
|
|
|
|
} |
55
|
67
|
50
|
|
|
|
310
|
unless ($size > 15) { |
56
|
0
|
|
|
|
|
0
|
$et->Warn('Bad PrintIM data'); |
57
|
0
|
|
|
|
|
0
|
return 0; |
58
|
|
|
|
|
|
|
} |
59
|
67
|
50
|
|
|
|
357
|
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
|
67
|
|
|
|
|
286
|
my $num = Get16u($dataPt, $offset + 14); |
65
|
67
|
100
|
|
|
|
419
|
if ($size < 16 + $num * 6) { |
66
|
|
|
|
|
|
|
# size is too big, maybe byte ordering is wrong |
67
|
1
|
|
|
|
|
9
|
ToggleByteOrder(); |
68
|
1
|
|
|
|
|
13
|
$num = Get16u($dataPt, $offset + 14); |
69
|
1
|
50
|
|
|
|
8
|
if ($size < 16 + $num * 6) { |
70
|
0
|
|
|
|
|
0
|
$et->Warn('Bad PrintIM size'); |
71
|
0
|
|
|
|
|
0
|
return 0; |
72
|
|
|
|
|
|
|
} |
73
|
|
|
|
|
|
|
} |
74
|
67
|
100
|
|
|
|
271
|
$verbose and $et->VerboseDir('PrintIM', $num); |
75
|
67
|
|
|
|
|
555
|
$et->HandleTag($tagTablePtr, 'PrintIMVersion', substr($$dataPt, $offset + 8, 4), |
76
|
|
|
|
|
|
|
DataPt => $dataPt, |
77
|
|
|
|
|
|
|
Start => $offset + 8, |
78
|
|
|
|
|
|
|
Size => 4, |
79
|
|
|
|
|
|
|
); |
80
|
67
|
|
|
|
|
190
|
my $n; |
81
|
67
|
|
|
|
|
324
|
for ($n=0; $n<$num; ++$n) { |
82
|
681
|
|
|
|
|
1269
|
my $pos = $offset + 16 + $n * 6; |
83
|
681
|
|
|
|
|
1515
|
my $tag = Get16u($dataPt, $pos); |
84
|
681
|
|
|
|
|
1659
|
my $val = Get32u($dataPt, $pos + 2); |
85
|
681
|
|
|
|
|
2012
|
$et->HandleTag($tagTablePtr, $tag, $val, |
86
|
|
|
|
|
|
|
Index => $n, |
87
|
|
|
|
|
|
|
DataPt => $dataPt, |
88
|
|
|
|
|
|
|
Start => $pos + 2, |
89
|
|
|
|
|
|
|
Size => 4, |
90
|
|
|
|
|
|
|
); |
91
|
|
|
|
|
|
|
} |
92
|
67
|
|
|
|
|
353
|
return 1; |
93
|
|
|
|
|
|
|
} |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
1; # end |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
__END__ |