source: gs2-extensions/parallel-building/trunk/src/perllib/cpan/Image/ExifTool/Pentax.pm@ 24626

Last change on this file since 24626 was 24626, checked in by jmt12, 13 years ago

An (almost) complete copy of the perllib directory from a (circa SEP2011) head checkout from Greenstone 2 trunk - in order to try and make merging in this extension a little easier later on (as there have been some major changes to buildcol.pl commited in the main trunk but not in the x64 branch)

File size: 155.1 KB
Line 
1#------------------------------------------------------------------------------
2# File: Pentax.pm
3#
4# Description: Pentax/Asahi EXIF maker notes tags
5#
6# Revisions: 11/25/2003 - P. Harvey Created
7# 02/10/2004 - P. Harvey Completely re-done
8# 02/16/2004 - W. Smith Updated (see ref 3)
9# 11/10/2004 - P. Harvey Added support for Asahi cameras
10# 01/10/2005 - P. Harvey Added LensType with values from ref 4
11# 03/30/2005 - P. Harvey Added new tags from ref 5
12# 10/04/2005 - P. Harvey Added MOV tags
13# 10/22/2007 - P. Harvey Got my new K10D! (more new tags to decode)
14# 11/03/2010 - P. Harvey Got my new K-5! (a gold mine of new tags to discover!)
15#
16# References: 1) Image::MakerNotes::Pentax
17# 2) http://johnst.org/sw/exiftags/ (Asahi cameras)
18# 3) Wayne Smith private communication (Optio 550)
19# 4) http://kobe1995.jp/~kaz/astro/istD.html
20# 5) John Francis (http://www.panix.com/~johnf/raw/index.html) (ist-D/ist-DS)
21# 6) http://www.cybercom.net/~dcoffin/dcraw/
22# 7) Douglas O'Brien private communication (*istD, K10D)
23# 8) Denis Bourez private communication
24# 9) Kazumichi Kawabata private communication
25# 10) David Buret private communication (*istD)
26# 11) http://forums.dpreview.com/forums/read.asp?forum=1036&message=17465929
27# 12) Derby Chang private communication
28# 13) http://homepage3.nifty.com/kamisaka/makernote/makernote_pentax.htm (2007/02/28)
29# 14) Ger Vermeulen private communication (Optio S6)
30# 15) Barney Garrett private communication (Samsung GX-1S)
31# 16) Axel Kellner private communication (K10D)
32# 17) Cvetan Ivanov private communication (K100D)
33# 18) http://www.gvsoft.homedns.org/exif/makernote-pentax-type3.html
34# 19) Dave Nicholson private communication (K10D)
35# 20) Bogdan and yeryry (http://www.cpanforum.com/posts/8037)
36# 21) Peter (*istD, http://www.cpanforum.com/posts/8078)
37# 22) Bozi (K10D, http://www.cpanforum.com/posts/8480)
38# 23) Akos Szalkai (https://rt.cpan.org/Ticket/Display.html?id=43743)
39# 24) Albert Bogner private communication
40# 25) Niels Kristian Bech Jensen private communication
41# JD) Jens Duttke private communication
42#
43# Notes: See POD documentation at the bottom of this file
44#------------------------------------------------------------------------------
45
46package Image::ExifTool::Pentax;
47
48use strict;
49use vars qw($VERSION);
50use Image::ExifTool::Exif;
51use Image::ExifTool::HP;
52
53$VERSION = '2.30';
54
55sub CryptShutterCount($$);
56sub PrintFilter($$$);
57
58# pentax lens type codes (ref 4)
59# The first number gives the lens series, and the 2nd gives the model number
60# Series numbers: K=1; A=2; F=3; FAJ=4; DFA=4,7; FA=3,4,5,6; FA*=5,6;
61# DA=3,4,7; DA*=7,8; FA645=11; DFA645=13
62my %pentaxLensTypes = (
63 Notes => q{
64 The first number gives the series of the lens, and the second identifies the
65 lens model. Note that newer series numbers may not always be properly
66 identified by cameras running older firmware versions. Decimal values
67 differentiate lenses which would otherwise have the same LensType, and are
68 used by the Composite LensID tag when attempting to identify the specific
69 lens model.
70 },
71 '0 0' => 'M-42 or No Lens', #17
72 '1 0' => 'K or M Lens',
73 '2 0' => 'A Series Lens', #7 (from smc PENTAX-A 400mm F5.6)
74 '3 0' => 'Sigma', # (includes 'Sigma 30mm F1.4 EX DC' - PH)
75 '3 17' => 'smc PENTAX-FA SOFT 85mm F2.8',
76 '3 18' => 'smc PENTAX-F 1.7X AF ADAPTER',
77 '3 19' => 'smc PENTAX-F 24-50mm F4',
78 '3 20' => 'smc PENTAX-F 35-80mm F4-5.6',
79 '3 21' => 'smc PENTAX-F 80-200mm F4.7-5.6',
80 '3 22' => 'smc PENTAX-F FISH-EYE 17-28mm F3.5-4.5',
81 '3 23' => 'smc PENTAX-F 100-300mm F4.5-5.6 or Sigma Lens',
82 '3 23.1' => 'Sigma AF 28-300mm F3.5-5.6 DL IF', #JD
83 '3 23.2' => 'Sigma AF 28-300mm F3.5-6.3 DG IF Macro', #JD
84 '3 24' => 'smc PENTAX-F 35-135mm F3.5-4.5',
85 '3 25' => 'smc PENTAX-F 35-105mm F4-5.6 or Sigma or Tokina Lens',
86 '3 25.1' => 'Sigma AF 28-300mm F3.5-5.6 DL IF', #11
87 '3 25.2' => 'Sigma 55-200mm F4-5.6 DC', #JD
88 '3 25.3' => 'Sigma AF 28-300mm F3.5-5.6 DL IF', #JD
89 '3 25.4' => 'Sigma AF 28-300mm F3.5-6.3 DG IF Macro', #JD
90 '3 25.5' => 'Tokina 80-200mm F2.8 ATX-Pro', #12
91 '3 26' => 'smc PENTAX-F* 250-600mm F5.6 ED[IF]',
92 '3 27' => 'smc PENTAX-F 28-80mm F3.5-4.5 or Tokina Lens',
93 '3 27.1' => 'Tokina AT-X Pro AF 28-70mm F2.6-2.8', #JD
94 '3 28' => 'smc PENTAX-F 35-70mm F3.5-4.5 or Tokina Lens',
95 '3 28.1' => 'Tokina 19-35mm F3.5-4.5 AF', #12
96 '3 29' => 'PENTAX-F 28-80mm F3.5-4.5 or Sigma or Tokina Lens',
97 '3 29.1' => 'Sigma AF 18-125mm F3.5-5.6 DC', #11
98 '3 29.2' => 'Tokina AT-X PRO 28-70mm F2.6-2.8', #22
99 '3 30' => 'PENTAX-F 70-200mm F4-5.6',
100 '3 31' => 'smc PENTAX-F 70-210mm F4-5.6 or Tokina or Takumar Lens',
101 '3 31.1' => 'Tokina AF 730 75-300mm F4.5-5.6',
102 '3 31.2' => 'Takumar-F 70-210mm F4-5.6', #JD
103 '3 32' => 'smc PENTAX-F 50mm F1.4',
104 '3 33' => 'smc PENTAX-F 50mm F1.7',
105 '3 34' => 'smc PENTAX-F 135mm F2.8 [IF]',
106 '3 35' => 'smc PENTAX-F 28mm F2.8',
107 '3 36' => 'Sigma 20mm F1.8 EX DG Aspherical RF',
108 '3 38' => 'smc PENTAX-F* 300mm F4.5 ED[IF]',
109 '3 39' => 'smc PENTAX-F* 600mm F4 ED[IF]',
110 '3 40' => 'smc PENTAX-F Macro 100mm F2.8',
111 '3 41' => 'smc PENTAX-F Macro 50mm F2.8 or Sigma Lens', #4
112 '3 41.1' => 'Sigma 50mm F2.8 Macro', #16
113 '3 44' => 'Sigma or Tamron Lens (3 44)',
114 '3 44.1' => 'Sigma AF 10-20mm F4-5.6 EX DC', #JD
115 '3 44.2' => 'Sigma 12-24mm F4.5 EX DG', #12
116 '3 44.3' => 'Sigma 17-70mm F2.8-4.5 DC Macro', #(Bart Hickman)
117 '3 44.4' => 'Sigma 18-50mm F3.5-5.6 DC', #4
118 '3 44.5' => 'Tamron 35-90mm F4 AF', #12
119 '3 46' => 'Sigma Lens (3 46)',
120 '3 46.1' => 'Sigma APO 70-200mm F2.8 EX',
121 '3 46.2' => 'Sigma EX APO 100-300mm F4 IF', #JD
122 '3 50' => 'smc PENTAX-FA 28-70mm F4 AL',
123 '3 51' => 'Sigma 28mm F1.8 EX DG Aspherical Macro',
124 '3 52' => 'smc PENTAX-FA 28-200mm F3.8-5.6 AL[IF] or Tamron Lens',
125 '3 52.1' => 'Tamron AF LD 28-200mm F3.8-5.6 [IF] Aspherical (171D)', #JD
126 '3 53' => 'smc PENTAX-FA 28-80mm F3.5-5.6 AL',
127 '3 247' => 'smc PENTAX-DA FISH-EYE 10-17mm F3.5-4.5 ED[IF]',
128 '3 248' => 'smc PENTAX-DA 12-24mm F4 ED AL[IF]',
129 '3 250' => 'smc PENTAX-DA 50-200mm F4-5.6 ED',
130 '3 251' => 'smc PENTAX-DA 40mm F2.8 Limited',
131 '3 252' => 'smc PENTAX-DA 18-55mm F3.5-5.6 AL',
132 '3 253' => 'smc PENTAX-DA 14mm F2.8 ED[IF]',
133 '3 254' => 'smc PENTAX-DA 16-45mm F4 ED AL',
134 '3 255' => 'Sigma Lens (3 255)',
135 '3 255.1' => 'Sigma 18-200mm F3.5-6.3 DC', #8
136 '3 255.2' => 'Sigma DL-II 35-80mm F4-5.6', #12
137 '3 255.3' => 'Sigma DL Zoom 75-300mm F4-5.6', #12
138 '3 255.4' => 'Sigma DF EX Aspherical 28-70mm F2.8', #12
139 '3 255.5' => 'Sigma AF Tele 400mm F5.6 Multi-coated', #JD
140 '3 255.6' => 'Sigma 24-60mm F2.8 EX DG', #PH
141 '3 255.7' => 'Sigma 70-300mm F4-5.6 Macro', #JD
142 '3 255.8' => 'Sigma 55-200mm F4-5.6 DC', #JD
143 '3 255.9' => 'Sigma 18-50mm F2.8 EX DC', #JD
144 '4 1' => 'smc PENTAX-FA SOFT 28mm F2.8',
145 '4 2' => 'smc PENTAX-FA 80-320mm F4.5-5.6',
146 '4 3' => 'smc PENTAX-FA 43mm F1.9 Limited',
147 '4 6' => 'smc PENTAX-FA 35-80mm F4-5.6',
148 '4 12' => 'smc PENTAX-FA 50mm F1.4', #17
149 '4 15' => 'smc PENTAX-FA 28-105mm F4-5.6 [IF]',
150 '4 16' => 'Tamron AF 80-210mm F4-5.6 (178D)', #13
151 '4 19' => 'Tamron SP AF 90mm F2.8 (172E)',
152 '4 20' => 'smc PENTAX-FA 28-80mm F3.5-5.6',
153 '4 21' => 'Cosina AF 100-300mm F5.6-6.7', #20
154 '4 22' => 'Tokina 28-80mm F3.5-5.6', #13
155 '4 23' => 'smc PENTAX-FA 20-35mm F4 AL',
156 '4 24' => 'smc PENTAX-FA 77mm F1.8 Limited',
157 '4 25' => 'Tamron SP AF 14mm F2.8', #13
158 '4 26' => 'smc PENTAX-FA Macro 100mm F3.5 or Cosina Lens',
159 '4 26.1' => 'Cosina 100mm F3.5 Macro', #JD
160 '4 27' => 'Tamron AF 28-300mm F3.5-6.3 LD Aspherical[IF] Macro (185D/285D)',
161 '4 28' => 'smc PENTAX-FA 35mm F2 AL',
162 '4 29' => 'Tamron AF 28-200mm F3.8-5.6 LD Super II Macro (371D)', #JD
163 '4 34' => 'smc PENTAX-FA 24-90mm F3.5-4.5 AL[IF]',
164 '4 35' => 'smc PENTAX-FA 100-300mm F4.7-5.8',
165 '4 36' => 'Tamron AF70-300mm F4-5.6 LD Macro', # both 572D and A17 (Di) - ref JD
166 '4 37' => 'Tamron SP AF 24-135mm F3.5-5.6 AD AL (190D)', #13
167 '4 38' => 'smc PENTAX-FA 28-105mm F3.2-4.5 AL[IF]',
168 '4 39' => 'smc PENTAX-FA 31mm F1.8 AL Limited',
169 '4 41' => 'Tamron AF 28-200mm Super Zoom F3.8-5.6 Aspherical XR [IF] Macro (A03)',
170 '4 43' => 'smc PENTAX-FA 28-90mm F3.5-5.6',
171 '4 44' => 'smc PENTAX-FA J 75-300mm F4.5-5.8 AL',
172 '4 45' => 'Tamron Lens (4 45)',
173 '4 45.1' => 'Tamron 28-300mm F3.5-6.3 Ultra zoom XR',
174 '4 45.2' => 'Tamron AF 28-300mm F3.5-6.3 XR Di LD Aspherical [IF] Macro', #JD
175 '4 46' => 'smc PENTAX-FA J 28-80mm F3.5-5.6 AL',
176 '4 47' => 'smc PENTAX-FA J 18-35mm F4-5.6 AL',
177 '4 49' => 'Tamron SP AF 28-75mm F2.8 XR Di (A09)',
178 '4 51' => 'smc PENTAX-D FA 50mm F2.8 Macro',
179 '4 52' => 'smc PENTAX-D FA 100mm F2.8 Macro',
180 '4 75' => 'Tamron SP AF 70-200mm F2.8 Di LD [IF] Macro (A001)', #JD
181 '4 229' => 'smc PENTAX-DA 18-55mm F3.5-5.6 AL II', #JD
182 '4 230' => 'Tamron SP AF 17-50mm F2.8 XR Di II', #20
183 '4 231' => 'smc PENTAX-DA 18-250mm F3.5-6.3 ED AL [IF]', #21
184 '4 237' => 'Samsung/Schneider D-XENOGON 10-17mm F3.5-4.5', #JD
185 '4 239' => 'Samsung D-XENON 12-24mm F4 ED AL [IF]', #23
186 '4 243' => 'smc PENTAX-DA 70mm F2.4 Limited', #JD
187 '4 244' => 'smc PENTAX-DA 21mm F3.2 AL Limited', #9
188 '4 245' => 'Schneider D-XENON 50-200mm F4-5.6', #15
189 '4 246' => 'Schneider D-XENON 18-55mm F3.5-5.6', #15
190 '4 247' => 'smc PENTAX-DA FISH-EYE 10-17mm F3.5-4.5 ED[IF]', #10
191 '4 248' => 'smc PENTAX-DA 12-24mm F4 ED AL [IF]', #10
192 '4 249' => 'Tamron XR DiII 18-200mm F3.5-6.3 (A14)',
193 '4 250' => 'smc PENTAX-DA 50-200mm F4-5.6 ED', #8
194 '4 251' => 'smc PENTAX-DA 40mm F2.8 Limited', #9
195 '4 252' => 'smc PENTAX-DA 18-55mm F3.5-5.6 AL', #8
196 '4 253' => 'smc PENTAX-DA 14mm F2.8 ED[IF]',
197 '4 254' => 'smc PENTAX-DA 16-45mm F4 ED AL',
198 '5 1' => 'smc PENTAX-FA* 24mm F2 AL[IF]',
199 '5 2' => 'smc PENTAX-FA 28mm F2.8 AL',
200 '5 3' => 'smc PENTAX-FA 50mm F1.7',
201 '5 4' => 'smc PENTAX-FA 50mm F1.4',
202 '5 5' => 'smc PENTAX-FA* 600mm F4 ED[IF]',
203 '5 6' => 'smc PENTAX-FA* 300mm F4.5 ED[IF]',
204 '5 7' => 'smc PENTAX-FA 135mm F2.8 [IF]',
205 '5 8' => 'smc PENTAX-FA Macro 50mm F2.8',
206 '5 9' => 'smc PENTAX-FA Macro 100mm F2.8',
207 '5 10' => 'smc PENTAX-FA* 85mm F1.4 [IF]',
208 '5 11' => 'smc PENTAX-FA* 200mm F2.8 ED[IF]',
209 '5 12' => 'smc PENTAX-FA 28-80mm F3.5-4.7',
210 '5 13' => 'smc PENTAX-FA 70-200mm F4-5.6',
211 '5 14' => 'smc PENTAX-FA* 250-600mm F5.6 ED[IF]',
212 '5 15' => 'smc PENTAX-FA 28-105mm F4-5.6',
213 '5 16' => 'smc PENTAX-FA 100-300mm F4.5-5.6',
214 '5 98' => 'smc PENTAX-FA 100-300mm F4.5-5.6', #JD (pre-production? - PH)
215 '6 1' => 'smc PENTAX-FA* 85mm F1.4 [IF]',
216 '6 2' => 'smc PENTAX-FA* 200mm F2.8 ED[IF]',
217 '6 3' => 'smc PENTAX-FA* 300mm F2.8 ED[IF]',
218 '6 4' => 'smc PENTAX-FA* 28-70mm F2.8 AL',
219 '6 5' => 'smc PENTAX-FA* 80-200mm F2.8 ED[IF]',
220 '6 6' => 'smc PENTAX-FA* 28-70mm F2.8 AL',
221 '6 7' => 'smc PENTAX-FA* 80-200mm F2.8 ED[IF]',
222 '6 8' => 'smc PENTAX-FA 28-70mm F4AL',
223 '6 9' => 'smc PENTAX-FA 20mm F2.8',
224 '6 10' => 'smc PENTAX-FA* 400mm F5.6 ED[IF]',
225 '6 13' => 'smc PENTAX-FA* 400mm F5.6 ED[IF]',
226 '6 14' => 'smc PENTAX-FA* Macro 200mm F4 ED[IF]',
227 '7 0' => 'smc PENTAX-DA 21mm F3.2 AL Limited', #13
228 '7 58' => 'smc PENTAX-D FA Macro 100mm F2.8 WR', #PH - this bit of information cost me $600 ;)
229 '7 75' => 'Tamron SP AF 70-200mm F2.8 Di LD [IF] Macro (A001)', #(Anton Bondar)
230 '7 214' => 'smc PENTAX-DA 35mm F2.4 AL', #PH
231 '7 216' => 'smc PENTAX-DA L 55-300mm F4-5.8 ED', #PH
232 '7 217' => 'smc PENTAX-DA 50-200mm F4-5.6 ED WR', #JD
233 '7 218' => 'smc PENTAX-DA 18-55mm F3.5-5.6 AL WR', #JD
234 '7 220' => 'Tamron SP AF 10-24mm F3.5-4.5 Di II LD Aspherical [IF]', #24
235 '7 221' => 'smc PENTAX-DA L 50-200mm F4-5.6 ED', #Ar't
236 '7 222' => 'smc PENTAX-DA L 18-55mm F3.5-5.6', #PH (tag 0x003f -- was '7 229' in LensInfo of one test image)
237 '7 223' => 'Samsung D-XENON 18-55mm F3.5-5.6 II', #PH
238 '7 224' => 'smc PENTAX-DA 15mm F4 ED AL Limited', #JD
239 '7 225' => 'Samsung D-XENON 18-250mm F3.5-6.3', #8/PH
240 '7 226' => 'smc PENTAX-DA* 55mm F1.4 SDM (SDM unused)', #PH (NC)
241 '7 227' => 'smc PENTAX DA* 60-250mm F4 [IF] SDM (SDM unused)', #PH (NC)
242 '7 229' => 'smc PENTAX-DA 18-55mm F3.5-5.6 AL II', #JD
243 '7 230' => 'Tamron AF 17-50mm F2.8 XR Di-II LD (Model A16)', #JD
244 '7 231' => 'smc PENTAX-DA 18-250mm F3.5-6.3 ED AL [IF]', #JD
245 '7 233' => 'smc PENTAX-DA 35mm F2.8 Macro Limited', #JD
246 '7 234' => 'smc PENTAX-DA* 300mm F4 ED [IF] SDM (SDM unused)', #19 (NC)
247 '7 235' => 'smc PENTAX-DA* 200mm F2.8 ED [IF] SDM (SDM unused)', #PH (NC)
248 '7 236' => 'smc PENTAX-DA 55-300mm F4-5.8 ED', #JD
249 '7 238' => 'Tamron AF 18-250mm F3.5-6.3 Di II LD Aspherical [IF] Macro', #JD
250 '7 241' => 'smc PENTAX-DA* 50-135mm F2.8 ED [IF] SDM (SDM unused)', #PH
251 '7 242' => 'smc PENTAX-DA* 16-50mm F2.8 ED AL [IF] SDM (SDM unused)', #19
252 '7 243' => 'smc PENTAX-DA 70mm F2.4 Limited', #PH
253 '7 244' => 'smc PENTAX-DA 21mm F3.2 AL Limited', #16
254 '8 14' => 'Sigma 17-70mm F2.8-4.0 DC Macro OS HSM', #(Hubert Meier)
255 '8 18' => 'Sigma 8-16mm F4.5-5.6 DC HSM', #http://u88.n24.queensu.ca/exiftool/forum/index.php/topic,2998.0.html
256 '8 215' => 'smc PENTAX-DA 18-135mm F3.5-5.6 ED AL [IF] DC WR', #PH
257 '8 226' => 'smc PENTAX-DA* 55mm F1.4 SDM', #JD
258 '8 227' => 'smc PENTAX DA* 60-250mm F4 [IF] SDM', #JD
259 '8 232' => 'smc PENTAX-DA 17-70mm F4 AL [IF] SDM', #JD
260 '8 234' => 'smc PENTAX-DA* 300mm F4 ED [IF] SDM', #19
261 '8 235' => 'smc PENTAX-DA* 200mm F2.8 ED [IF] SDM', #JD
262 '8 241' => 'smc PENTAX-DA* 50-135mm F2.8 ED [IF] SDM', #JD
263 '8 242' => 'smc PENTAX-DA* 16-50mm F2.8 ED AL [IF] SDM', #JD
264 '8 255' => 'Sigma Lens (8 255)',
265 '8 255.1' => 'Sigma 70-200mm F2.8 EX DG Macro HSM II', #JD
266 '8 255.2' => 'Sigma APO 150-500mm F5-6.3 DG OS HSM', #JD
267 '8 255.3' => 'Sigma 50-150mm F2.8 II APO EX DC HSM', #http://u88.n24.queensu.ca/exiftool/forum/index.php/topic,2997.0.html
268 '11 4' => 'smc PENTAX-FA 645 45-85mm F4.5', #PH
269 '11 8' => 'smc PENTAX-FA 645 80-160mm F4.5', #PH
270 '11 11' => 'smc PENTAX-FA 645 35mm F3.5 AL [IF]', #PH
271 '11 17' => 'smc PENTAX-FA 645 150-300mm F5.6 ED [IF]', #PH
272 '13 18' => 'smc PENTAX-D FA 645 55mm F2.8 AL [IF] SDM AW', #PH
273);
274
275# Pentax model ID codes - PH
276my %pentaxModelID = (
277 0x0000d => 'Optio 330/430',
278 0x12926 => 'Optio 230',
279 0x12958 => 'Optio 330GS',
280 0x12962 => 'Optio 450/550',
281 0x1296c => 'Optio S',
282 0x12971 => 'Optio S V1.01',
283 0x12994 => '*ist D',
284 0x129b2 => 'Optio 33L',
285 0x129bc => 'Optio 33LF',
286 0x129c6 => 'Optio 33WR/43WR/555',
287 0x129d5 => 'Optio S4',
288 0x12a02 => 'Optio MX',
289 0x12a0c => 'Optio S40',
290 0x12a16 => 'Optio S4i',
291 0x12a34 => 'Optio 30',
292 0x12a52 => 'Optio S30',
293 0x12a66 => 'Optio 750Z',
294 0x12a70 => 'Optio SV',
295 0x12a75 => 'Optio SVi',
296 0x12a7a => 'Optio X',
297 0x12a8e => 'Optio S5i',
298 0x12a98 => 'Optio S50',
299 0x12aa2 => '*ist DS',
300 0x12ab6 => 'Optio MX4',
301 0x12ac0 => 'Optio S5n',
302 0x12aca => 'Optio WP',
303 0x12afc => 'Optio S55',
304 0x12b10 => 'Optio S5z',
305 0x12b1a => '*ist DL',
306 0x12b24 => 'Optio S60',
307 0x12b2e => 'Optio S45',
308 0x12b38 => 'Optio S6',
309 0x12b4c => 'Optio WPi', #13
310 0x12b56 => 'BenQ DC X600',
311 0x12b60 => '*ist DS2',
312 0x12b62 => 'Samsung GX-1S',
313 0x12b6a => 'Optio A10',
314 0x12b7e => '*ist DL2',
315 0x12b80 => 'Samsung GX-1L',
316 0x12b9c => 'K100D',
317 0x12b9d => 'K110D',
318 0x12ba2 => 'K100D Super', #JD
319 0x12bb0 => 'Optio T10/T20',
320 0x12be2 => 'Optio W10',
321 0x12bf6 => 'Optio M10',
322 0x12c1e => 'K10D',
323 0x12c20 => 'Samsung GX10',
324 0x12c28 => 'Optio S7',
325 0x12c2d => 'Optio L20',
326 0x12c32 => 'Optio M20',
327 0x12c3c => 'Optio W20',
328 0x12c46 => 'Optio A20',
329 0x12c8c => 'Optio M30',
330 0x12c78 => 'Optio E30',
331 0x12c7d => 'Optio E35',
332 0x12c82 => 'Optio T30',
333 0x12c91 => 'Optio L30',
334 0x12c96 => 'Optio W30',
335 0x12ca0 => 'Optio A30',
336 0x12cb4 => 'Optio E40',
337 0x12cbe => 'Optio M40',
338 0x12cc3 => 'Optio L40',
339 0x12cc5 => 'Optio L36',
340 0x12cc8 => 'Optio Z10',
341 0x12cd2 => 'K20D',
342 0x12cd4 => 'Samsung GX20', #8
343 0x12cdc => 'Optio S10',
344 0x12ce6 => 'Optio A40',
345 0x12cf0 => 'Optio V10',
346 0x12cfa => 'K200D',
347 0x12d04 => 'Optio S12',
348 0x12d0e => 'Optio E50',
349 0x12d18 => 'Optio M50',
350 0x12d22 => 'Optio L50',
351 0x12d2c => 'Optio V20',
352 0x12d40 => 'Optio W60',
353 0x12d4a => 'Optio M60',
354 0x12d68 => 'Optio E60/M90',
355 0x12d72 => 'K2000',
356 0x12d73 => 'K-m',
357 0x12d86 => 'Optio P70',
358 0x12d90 => 'Optio L70',
359 0x12d9a => 'Optio E70',
360 0x12dae => 'X70',
361 0x12db8 => 'K-7',
362 0x12dcc => 'Optio W80',
363 0x12dea => 'Optio P80',
364 0x12df4 => 'Optio WS80',
365 0x12dfe => 'K-x',
366 0x12e08 => '645D',
367 0x12e12 => 'Optio E80',
368 0x12e30 => 'Optio W90',
369 0x12e3a => 'Optio I-10',
370 0x12e44 => 'Optio H90',
371 0x12e4e => 'Optio E90',
372 0x12e58 => 'X90',
373 0x12e6c => 'K-r',
374 0x12e76 => 'K-5',
375 0x12e8a => 'Optio RS1000 / RS1500',
376 0x12e94 => 'Optio RZ10',
377 0x12ebc => 'Optio WG-1 GPS',
378);
379
380# Pentax city codes - (PH, Optio WP)
381my %pentaxCities = (
382 0 => 'Pago Pago',
383 1 => 'Honolulu',
384 2 => 'Anchorage',
385 3 => 'Vancouver',
386 4 => 'San Fransisco',
387 5 => 'Los Angeles',
388 6 => 'Calgary',
389 7 => 'Denver',
390 8 => 'Mexico City',
391 9 => 'Chicago',
392 10 => 'Miami',
393 11 => 'Toronto',
394 12 => 'New York',
395 13 => 'Santiago',
396 14 => 'Caracus',
397 15 => 'Halifax',
398 16 => 'Buenos Aires',
399 17 => 'Sao Paulo',
400 18 => 'Rio de Janeiro',
401 19 => 'Madrid',
402 20 => 'London',
403 21 => 'Paris',
404 22 => 'Milan',
405 23 => 'Rome',
406 24 => 'Berlin',
407 25 => 'Johannesburg',
408 26 => 'Istanbul',
409 27 => 'Cairo',
410 28 => 'Jerusalem',
411 29 => 'Moscow',
412 30 => 'Jeddah',
413 31 => 'Tehran',
414 32 => 'Dubai',
415 33 => 'Karachi',
416 34 => 'Kabul',
417 35 => 'Male',
418 36 => 'Delhi',
419 37 => 'Colombo',
420 38 => 'Kathmandu',
421 39 => 'Dacca',
422 40 => 'Yangon',
423 41 => 'Bangkok',
424 42 => 'Kuala Lumpur',
425 43 => 'Vientiane',
426 44 => 'Singapore',
427 45 => 'Phnom Penh',
428 46 => 'Ho Chi Minh',
429 47 => 'Jakarta',
430 48 => 'Hong Kong',
431 49 => 'Perth',
432 50 => 'Beijing',
433 51 => 'Shanghai',
434 52 => 'Manila',
435 53 => 'Taipei',
436 54 => 'Seoul',
437 55 => 'Adelaide',
438 56 => 'Tokyo',
439 57 => 'Guam',
440 58 => 'Sydney',
441 59 => 'Noumea',
442 60 => 'Wellington',
443 61 => 'Auckland',
444 62 => 'Lima',
445 63 => 'Dakar',
446 64 => 'Algiers',
447 65 => 'Helsinki',
448 66 => 'Athens',
449 67 => 'Nairobi',
450 68 => 'Amsterdam',
451 69 => 'Stockholm',
452 70 => 'Lisbon', #14
453 71 => 'Copenhagen', #25
454 72 => 'Warsaw',
455 73 => 'Prague',
456 74 => 'Budapest',
457);
458
459# digital filter tag information (ref PH, K-5)
460# (also see %filterSettings below for decoding of filter parameters)
461my %digitalFilter = (
462 Format => 'undef[17]',
463 RawConv => '($val!~/^\\0/ or $$self{OPTIONS}{Unknown}) ? join(" ",unpack("Cc*",$val)) : undef',
464 SeparateTable => 'DigitalFilter',
465 ValueConvInv => q{
466 return "\0" x 17 if $val eq "0";
467 $val = pack("Cc*", $val=~/[-+]?\d+/g);
468 length($val)==17 or warn("Expecting 17 values\n"), return undef;
469 return $val;
470 },
471 PrintConv => {
472 OTHER => \&PrintFilter, # this routine actually converts all values
473 0 => 'Off',
474 1 => 'Base Parameter Adjust',
475 2 => 'Soft Focus',
476 3 => 'High Contrast',
477 4 => 'Color Filter',
478 5 => 'Extract Color',
479 6 => 'Monochrome',
480 7 => 'Slim',
481 9 => 'Fisheye',
482 10 => 'Toy Camera',
483 11 => 'Retro',
484 12 => 'Pastel',
485 13 => 'Water Color',
486 14 => 'HDR',
487 16 => 'Miniature',
488 17 => 'Starburst',
489 18 => 'Posterization',
490 19 => 'Sketch Filter',
491 254 => 'Custom Filter',
492 },
493);
494
495# digital filter setting names and conversions (ref PH, K-5)
496# Note: names must be unique for writing
497my %filterSettings = (
498 1 => ['Brightness', '%+d'], # BPA (-8-+8)
499 2 => ['Saturation', '%+d'], # BPA (-3-+3)
500 3 => ['Hue', '%+d'], # BPA (-3-+3)
501 4 => ['Contrast', '%+d'], # BPA (-3-+3)
502 5 => ['Sharpness', '%+d'], # BPA (-3-+3)
503 6 => ['SoftFocus', '%d'], # Soft Focus/Custom (1-3)
504 7 => ['ShadowBlur', { 0=>'Off',1=>'On' }], # Soft Focus
505 8 => ['HighContrast', '%d'], # High Contrast/Custom (1-5)
506 9 => ['Color', { 1=>'Red',2=>'Magenta',3=>'Blue',4=>'Cyan',5=>'Green',6=>'Yellow' }], # Color Filter
507 10 => ['Density', { 1=>'Light',2=>'Standard',3=>'Dark' }], # Color Filter
508 11 => ['ExtractedColor',{ 0=>'Off',1=>'Red',2=>'Magenta',3=>'Blue',4=>'Cyan',5=>'Green',6=>'Yellow' }], # ExtractColor [x2]
509 12 => ['ColorRange', '%+d'], # ExtractColor [x2] (-2-+2)
510 13 => ['FilterEffect', { 0=>'Off',1=>'Red',2=>'Green',3=>'Blue',4=>'Infrared'}], # Monochrome
511 14 => ['ToningBA', '%+d'], # Monochrome (-3-+3)
512 15 => ['InvertColor', { 0=>'Off',1=>'On' }], # Custom
513 16 => ['Slim', '%+d'], # Slim (-8-+8)
514 17 => ['EffectDensity', { 1=>'Sparse',2=>'Normal',3=>'Dense' }], # Starburst
515 18 => ['Size', { 1=>'Small',2=>'Medium',3=>'Large' }], # Starburst
516 19 => ['Angle', { 0=>'0deg',2=>'30deg',3=>'45deg',4=>'60deg'}], # Starburst (1 is unused)
517 20 => ['Fisheye', { 1=>'Weak',2=>'Medium',3=>'Strong' }], # Fisheye
518 21 => ['DistortionType', '%d'], # Custom (1-3)
519 22 => ['DistortionLevel',{0=>'Off',1=>'Weak',2=>'Medium',3=>'Strong' }], #Custom
520 23 => ['ShadingType', '%d'], # Custom (1-6)
521 24 => ['ShadingLevel', '%+d'], # Custom (-3-+3)
522 25 => ['Shading', '%d'], # Toy Camera (1-3)
523 26 => ['Blur', '%d'], # Toy Camera (1-3)
524 27 => ['ToneBreak', { 0=>'Off',1=>'Red',2=>'Green',3=>'Blue',4=>'Yellow'}], # Toy Camera/Custom
525 28 => ['Toning', '%+d'], # Retro (-3-+3)
526 29 => ['FrameComposite',{ 0=>'None',1=>'Thin',2=>'Medium',3=>'Thick' }], # Retro
527 30 => ['PastelStrength',{ 1=>'Weak',2=>'Medium',3=>'Strong' }], # Pastel
528 31 => ['Intensity', '%d'], # Water Color (1-3)
529 32 => ['Saturation2', { 0=>'Off',1=>'Low',2=>'Medium',3=>'High' }], # Water Color
530 33 => ['HDR', { 1=>'Weak',2=>'Medium',3=>'Strong' }], # HDR
531 35 => ['FocusPlane', '%+d'], # Miniature (-3-+3)
532 36 => ['FocusWidth', { 1=>'Narrow',2=>'Middle',3=>'Wide' }], # Miniature
533 37 => ['PlaneAngle', { 0=>'Horizontal',1=>'Vertical',2=>'Positive slope',3=>'Negative slope' }], # Miniature
534 38 => ['Blur2', '%d'], # Miniature (1-3)
535 39 => ['Shape', { 1=>'Cross',2=>'Star',3=>'Snowflake',4=>'Heart',5=>'Note'}], # Starburst
536 40 => ['Posterization', '%d'], # Posterization (1-5)
537 41 => ['Contrast2', { 1=>'Low',2=>'Medium',3=>'High'}], # Sketch Filter
538 42 => ['ScratchEffect', { 0=>'Off',1=>'On' }], # Sketch Filter
539);
540
541# decoding for Pentax Firmware ID tags - PH
542my %pentaxFirmwareID = (
543 # the first 2 numbers are the firmware version, I'm not sure what the second 2 mean
544 # Note: the byte order may be different for some models
545 # which give, for example, version 0.01 instead of 1.00
546 ValueConv => sub {
547 my $val = shift;
548 return $val unless length($val) == 4;
549 # (value is encrypted by toggling all bits)
550 my @a = map { $_ ^ 0xff } unpack("C*",$val);
551 return sprintf('%d %.2d %.2d %.2d', @a);
552 },
553 ValueConvInv => sub {
554 my $val = shift;
555 my @a = $val=~/\b\d+\b/g;
556 return $val unless @a == 4;
557 @a = map { ($_ & 0xff) ^ 0xff } @a;
558 return pack("C*", @a);
559 },
560 PrintConv => '$val=~tr/ /./; $val',
561 PrintConvInv => '$val=~s/^(\d+)\.(\d+)\.(\d+)\.(\d+)/$1 $2 $3 $4/ ? $val : undef',
562);
563
564# convert 16 or 77 metering segment values to approximate LV equivalent - PH
565my %convertMeteringSegments = (
566 PrintConv => sub { join ' ', map(
567 { $_==255 ? 'n/a' : $_==0 ? '0' : sprintf '%.1f', $_ / 8 - 6 } split(' ',$_[0])
568 ) },
569 PrintConvInv => sub { join ' ', map(
570 { /^n/i ? 255 : $_==0 ? '0' : int(($_ + 6) * 8 + 0.5) } split(' ',$_[0])
571 ) },
572);
573
574# lens code conversions
575my %lensCode = (
576 Unknown => 1,
577 PrintConv => 'sprintf("0x%.2x", $val)',
578 PrintConvInv => 'hex($val)',
579);
580
581# common attributes for writable BinaryData directories
582my %binaryDataAttrs = (
583 PROCESS_PROC => \&Image::ExifTool::ProcessBinaryData,
584 WRITE_PROC => \&Image::ExifTool::WriteBinaryData,
585 CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
586 WRITABLE => 1,
587 FIRST_ENTRY => 0,
588);
589
590# Pentax makernote tags
591%Image::ExifTool::Pentax::Main = (
592 WRITE_PROC => \&Image::ExifTool::Exif::WriteExif,
593 CHECK_PROC => \&Image::ExifTool::Exif::CheckExif,
594 GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
595 WRITABLE => 1,
596 0x0000 => { #5
597 Name => 'PentaxVersion',
598 Writable => 'int8u',
599 Count => 4,
600 PrintConv => '$val=~tr/ /./; $val',
601 PrintConvInv => '$val=~tr/./ /; $val',
602 },
603 0x0001 => { #PH
604 Name => 'PentaxModelType',
605 Writable => 'int16u',
606 # (values of 0-5 seem to group models into 6 categories, ref 13)
607 },
608 0x0002 => { #PH
609 Name => 'PreviewImageSize',
610 Groups => { 2 => 'Image' },
611 Writable => 'int16u',
612 Count => 2,
613 PrintConv => '$val =~ tr/ /x/; $val',
614 },
615 0x0003 => { #PH
616 Name => 'PreviewImageLength',
617 OffsetPair => 0x0004, # point to associated offset
618 DataTag => 'PreviewImage',
619 Groups => { 2 => 'Image' },
620 Writable => 'int32u',
621 Protected => 2,
622 },
623 0x0004 => { #PH
624 Name => 'PreviewImageStart',
625 IsOffset => 2, # code to use original base
626 Protected => 2,
627 OffsetPair => 0x0003, # point to associated byte count
628 DataTag => 'PreviewImage',
629 Groups => { 2 => 'Image' },
630 Writable => 'int32u',
631 },
632 0x0005 => { #13
633 Name => 'PentaxModelID',
634 Writable => 'int32u',
635 PrintHex => 1,
636 SeparateTable => 1,
637 PrintConv => \%pentaxModelID,
638 },
639 0x0006 => { #5
640 # Note: Year is int16u in MM byte ordering regardless of EXIF byte order
641 Name => 'Date',
642 Groups => { 2 => 'Time' },
643 Notes => 'changing either Date or Time will affect ShutterCount decryption',
644 Writable => 'undef',
645 Count => 4,
646 Shift => 'Time',
647 DataMember => 'PentaxDate',
648 RawConv => '$$self{PentaxDate} = $val', # save to decrypt ShutterCount
649 ValueConv => 'length($val)==4 ? sprintf("%.4d:%.2d:%.2d",unpack("nC2",$val)) : "Unknown ($val)"',
650 ValueConvInv => q{
651 $val =~ s/(\d) .*/$1/; # remove Time
652 my @v = split /:/, $val;
653 return pack("nC2",$v[0],$v[1],$v[2]);
654 },
655 },
656 0x0007 => { #5
657 Name => 'Time',
658 Groups => { 2 => 'Time' },
659 Writable => 'undef',
660 Count => 3,
661 Shift => 'Time',
662 DataMember => 'PentaxTime',
663 RawConv => '$$self{PentaxTime} = $val', # save to decrypt ShutterCount
664 ValueConv => 'length($val)>=3 ? sprintf("%.2d:%.2d:%.2d",unpack("C3",$val)) : "Unknown ($val)"',
665 ValueConvInv => q{
666 $val =~ s/^[0-9:]+ (\d)/$1/; # remove Date
667 return pack("C3",split(/:/,$val));
668 },
669 },
670 0x0008 => { #2
671 Name => 'Quality',
672 Writable => 'int16u',
673 PrintConvColumns => 2,
674 PrintConv => {
675 0 => 'Good',
676 1 => 'Better',
677 2 => 'Best',
678 3 => 'TIFF', #5
679 4 => 'RAW', #5
680 5 => 'Premium', #PH (K20D)
681 },
682 },
683 0x0009 => { #3
684 Name => 'PentaxImageSize',
685 Groups => { 2 => 'Image' },
686 Writable => 'int16u',
687 PrintConvColumns => 2,
688 PrintConv => {
689 0 => '640x480',
690 1 => 'Full', #PH - this can mean 2048x1536 or 2240x1680 or ... ?
691 2 => '1024x768',
692 3 => '1280x960', #PH (Optio WP)
693 4 => '1600x1200',
694 5 => '2048x1536',
695 8 => '2560x1920 or 2304x1728', #PH (Optio WP) or #14
696 9 => '3072x2304', #PH (Optio M30)
697 10 => '3264x2448', #13
698 19 => '320x240', #PH (Optio WP)
699 20 => '2288x1712', #13
700 21 => '2592x1944',
701 22 => '2304x1728 or 2592x1944', #2 or #14
702 23 => '3056x2296', #13
703 25 => '2816x2212 or 2816x2112', #13 or #14
704 27 => '3648x2736', #PH (Optio A20)
705 29 => '4000x3000', #PH (X70)
706 30 => '4288x3216', #PH (Optio RS1000)
707 129 => '1920x1080', #PH (Optio RZ10)
708 257 => '3216x3216', #PH (Optio RZ10)
709 '0 0' => '2304x1728', #13
710 '4 0' => '1600x1200', #PH (Optio MX4)
711 '5 0' => '2048x1536', #13
712 '8 0' => '2560x1920', #13
713 '32 2' => '960x640', #7
714 '33 2' => '1152x768', #7
715 '34 2' => '1536x1024', #7
716 '35 1' => '2400x1600', #7
717 '36 0' => '3008x2008 or 3040x2024', #PH
718 '37 0' => '3008x2000', #13
719 },
720 },
721 0x000b => { #3
722 Name => 'PictureMode',
723 Writable => 'int16u',
724 Count => -1,
725 Notes => q{
726 1 or 2 values. Decimal values differentiate Optio 555 modes which are
727 different from other models
728 },
729 ValueConv => '($val < 4 and $$self{Model} =~ /Optio 555\b/) ? $val + 0.1 : $val',
730 ValueConvInv => 'int $val',
731 PrintConvColumns => 2,
732 PrintConv => [{
733 0 => 'Program', #PH
734 0.1 => 'Av', #PH (Optio 555)
735 1 => 'Shutter Speed Priority', #JD
736 1.1 => 'M', #PH (Optio 555)
737 2 => 'Program AE', #13
738 2.1 => 'Tv', #PH (Optio 555)
739 3 => 'Manual', #13
740 3.1 => 'USER', #PH (Optio 555)
741 5 => 'Portrait',
742 6 => 'Landscape',
743 8 => 'Sport', #PH
744 9 => 'Night Scene',
745 # 10 "full mode"? #13
746 11 => 'Soft', #PH
747 12 => 'Surf & Snow',
748 13 => 'Candlelight', #13
749 14 => 'Autumn',
750 15 => 'Macro',
751 17 => 'Fireworks',
752 18 => 'Text',
753 19 => 'Panorama', #PH
754 20 => '3-D', #PH (Optio 555)
755 21 => 'Black & White', #PH (Optio 555)
756 22 => 'Sepia', #PH (Optio 555)
757 23 => 'Red', #PH (Optio 555)
758 24 => 'Pink', #PH (Optio 555)
759 25 => 'Purple', #PH (Optio 555)
760 26 => 'Blue', #PH (Optio 555)
761 27 => 'Green', #PH (Optio 555)
762 28 => 'Yellow', #PH (Optio 555)
763 30 => 'Self Portrait', #PH
764 31 => 'Illustrations', #13
765 33 => 'Digital Filter', #13
766 35 => 'Night Scene Portrait', #25
767 37 => 'Museum', #PH
768 38 => 'Food', #PH
769 39 => 'Underwater', #25
770 40 => 'Green Mode', #PH
771 49 => 'Light Pet', #PH
772 50 => 'Dark Pet', #PH
773 51 => 'Medium Pet', #PH
774 53 => 'Underwater', #PH
775 54 => 'Candlelight', #PH
776 55 => 'Natural Skin Tone', #PH
777 56 => 'Synchro Sound Record', #PH
778 58 => 'Frame Composite', #14
779 59 => 'Report', #25
780 60 => 'Kids', #13
781 61 => 'Blur Reduction', #13
782 65 => 'Half-length Portrait', #JD
783 221 => 'P', #PH (Optio 555)
784 255=> 'PICT', #PH (Optio 555)
785 }],
786 },
787 0x000c => { #PH
788 Name => 'FlashMode',
789 Writable => 'int16u',
790 Count => -1,
791 PrintHex => 1,
792 PrintConv => [{
793 0x000 => 'Auto, Did not fire',
794 0x001 => 'Off, Did not fire',
795 0x002 => 'On, Did not fire', #19
796 0x003 => 'Auto, Did not fire, Red-eye reduction',
797 0x005 => 'On, Did not fire, Wireless (Master)', #19
798 0x100 => 'Auto, Fired',
799 0x102 => 'On, Fired',
800 0x103 => 'Auto, Fired, Red-eye reduction',
801 0x104 => 'On, Red-eye reduction',
802 0x105 => 'On, Wireless (Master)', #19
803 0x106 => 'On, Wireless (Control)', #19
804 0x108 => 'On, Soft',
805 0x109 => 'On, Slow-sync',
806 0x10a => 'On, Slow-sync, Red-eye reduction',
807 0x10b => 'On, Trailing-curtain Sync',
808 },{ #19 (AF-540FGZ flash)
809 0x000 => 'n/a - Off-Auto-Aperture', #19
810 0x03f => 'Internal',
811 0x100 => 'External, Auto',
812 0x23f => 'External, Flash Problem', #JD
813 0x300 => 'External, Manual',
814 0x304 => 'External, P-TTL Auto',
815 0x305 => 'External, Contrast-control Sync', #JD
816 0x306 => 'External, High-speed Sync',
817 0x30c => 'External, Wireless',
818 0x30d => 'External, Wireless, High-speed Sync',
819 }],
820 },
821 0x000d => [ #2
822 {
823 Name => 'FocusMode',
824 Condition => '$self->{Make} =~ /^PENTAX/',
825 Notes => 'Pentax models',
826 Writable => 'int16u',
827 PrintConvColumns => 2,
828 PrintConv => { #PH
829 0 => 'Normal',
830 1 => 'Macro',
831 2 => 'Infinity',
832 3 => 'Manual',
833 4 => 'Super Macro', #JD
834 5 => 'Pan Focus',
835 16 => 'AF-S', #17
836 17 => 'AF-C', #17
837 18 => 'AF-A', #PH (educated guess)
838 32 => 'Contrast-detect', #PH (K-5)
839 33 => 'Tracking Contrast-detect', #PH (K-5)
840 },
841 },
842 {
843 Name => 'FocusMode',
844 Writable => 'int16u',
845 Notes => 'Asahi models',
846 PrintConv => { #2
847 0 => 'Normal',
848 1 => 'Macro (1)',
849 2 => 'Macro (2)',
850 3 => 'Infinity',
851 },
852 },
853 ],
854 0x000e => { #7
855 Name => 'AFPointSelected',
856 Writable => 'int16u',
857 PrintConvColumns => 2,
858 PrintConv => {
859 # 0 - Contrast-detect AF? - PH (K-5)
860 0xffff => 'Auto',
861 0xfffe => 'Fixed Center',
862 0xfffd => 'Automatic Tracking AF', #JD
863 0xfffc => 'Face Detect AF', #JD
864 1 => 'Upper-left',
865 2 => 'Top',
866 3 => 'Upper-right',
867 4 => 'Left',
868 5 => 'Mid-left',
869 6 => 'Center',
870 7 => 'Mid-right',
871 8 => 'Right',
872 9 => 'Lower-left',
873 10 => 'Bottom',
874 11 => 'Lower-right',
875 },
876 },
877 0x000f => { #PH
878 Name => 'AFPointsInFocus',
879 Writable => 'int16u',
880 PrintHex => 1,
881 PrintConv => {
882 0xffff => 'None',
883 0 => 'Fixed Center or Multiple', #PH/14
884 1 => 'Top-left',
885 2 => 'Top-center',
886 3 => 'Top-right',
887 4 => 'Left',
888 5 => 'Center',
889 6 => 'Right',
890 7 => 'Bottom-left',
891 8 => 'Bottom-center',
892 9 => 'Bottom-right',
893 },
894 },
895 0x0010 => { #PH
896 Name => 'FocusPosition',
897 Writable => 'int16u',
898 Notes => 'related to focus distance but affected by focal length',
899 },
900 0x0012 => { #PH
901 Name => 'ExposureTime',
902 Writable => 'int32u',
903 Priority => 0,
904 ValueConv => '$val * 1e-5',
905 ValueConvInv => '$val * 1e5',
906 # value may be 0xffffffff in Bulb mode (ref JD)
907 PrintConv => '$val > 42949 ? "Unknown (Bulb)" : Image::ExifTool::Exif::PrintExposureTime($val)',
908 PrintConvInv => '$val=~/(unknown|bulb)/i ? $val : Image::ExifTool::Exif::ConvertFraction($val)',
909 },
910 0x0013 => { #PH
911 Name => 'FNumber',
912 Writable => 'int16u',
913 Priority => 0,
914 ValueConv => '$val / 10',
915 ValueConvInv => '$val * 10',
916 PrintConv => 'sprintf("%.1f",$val)',
917 PrintConvInv => '$val',
918 },
919 # ISO Tag - Entries confirmed by W. Smith 12 FEB 04
920 0x0014 => {
921 Name => 'ISO',
922 Writable => 'int16u',
923 Notes => 'may be different than EXIF:ISO, which can round to the nearest full stop',
924 PrintConvColumns => 4,
925 PrintConv => {
926 # 1/3 EV step values
927 3 => 50,
928 4 => 64,
929 5 => 80,
930 6 => 100,
931 7 => 125, #PH
932 8 => 160, #PH
933 9 => 200,
934 10 => 250,
935 11 => 320, #PH
936 12 => 400,
937 13 => 500,
938 14 => 640,
939 15 => 800,
940 16 => 1000,
941 17 => 1250,
942 18 => 1600, #PH
943 19 => 2000, #PH
944 20 => 2500, #PH
945 21 => 3200, #PH
946 22 => 4000,
947 23 => 5000,
948 24 => 6400, #PH
949 25 => 8000, #PH
950 26 => 10000, #PH
951 27 => 12800, #PH
952 28 => 16000, #PH
953 29 => 20000, #PH
954 30 => 25600, #PH
955 31 => 32000, #PH
956 32 => 40000, #PH
957 33 => 51200, #PH
958 # Optio 330/430 (oddball)
959 50 => 50, #PH
960 100 => 100, #PH
961 200 => 200, #PH
962 400 => 400, #PH
963 800 => 800, #PH
964 1600 => 1600, #PH
965 3200 => 3200, #PH
966 # 1/2 EV step values
967 258 => 50, #PH (NC)
968 259 => 70, #PH (NC)
969 260 => 100, #19
970 261 => 140, #19
971 262 => 200, #19
972 263 => 280, #19
973 264 => 400, #19
974 265 => 560, #19
975 266 => 800, #19
976 267 => 1100, #19
977 268 => 1600, #19
978 269 => 2200, #PH
979 270 => 3200, #PH
980 271 => 4500, #PH
981 272 => 6400, #PH
982 273 => 9000, #PH
983 274 => 12800, #PH
984 275 => 18000, #PH
985 276 => 25600, #PH
986 277 => 36000, #PH
987 278 => 51200, #PH
988 },
989 },
990 0x0015 => { #PH
991 Name => 'LightReading',
992 Format => 'int16s', # (because I may have seen negative numbers)
993 Writable => 'int16u',
994 # ranges from 0-12 for my Optio WP - PH
995 Notes => q{
996 calibrated differently for different models. For the Optio WP, add 6 to get
997 approximate Light Value. May not be valid for some models, ie. Optio S
998 },
999 },
1000 0x0016 => { #PH
1001 Name => 'ExposureCompensation',
1002 Writable => 'int16u',
1003 ValueConv => '($val - 50) / 10',
1004 ValueConvInv => 'int($val * 10 + 50.5)',
1005 PrintConv => '$val ? sprintf("%+.1f", $val) : 0',
1006 PrintConvInv => 'Image::ExifTool::Exif::ConvertFraction($val)',
1007 },
1008 0x0017 => { #3
1009 Name => 'MeteringMode',
1010 Writable => 'int16u',
1011 PrintConv => {
1012 0 => 'Multi-segment',
1013 1 => 'Center-weighted average',
1014 2 => 'Spot',
1015 # have seen value of 16 for E70
1016 },
1017 },
1018 0x0018 => { #PH
1019 Name => 'AutoBracketing',
1020 Writable => 'int16u',
1021 Count => -1,
1022 Notes => q{
1023 1 or 2 values: exposure bracket step in EV, then extended bracket if
1024 available. Extended bracket values are printed as 'WB-BA', 'WB-GM',
1025 'Saturation', 'Sharpness', 'Contrast', 'Hue' or 'HighLowKey' followed by
1026 '+1', '+2' or '+3' for step size
1027 },
1028 # 1=.3ev, 2=.7, 3=1.0, ... 10=.5ev, 11=1.5, ...
1029 ValueConv => [ '$val<10 ? $val/3 : $val-9.5' ],
1030 ValueConvInv => [ 'abs($val-int($val)-.5)>0.05 ? int($val*3+0.5) : int($val+10)' ],
1031 PrintConv => sub {
1032 my @v = split(' ', shift);
1033 $v[0] = sprintf('%.1f', $v[0]) if $v[0];
1034 if ($v[1]) {
1035 my %s = (1=>'WB-BA',2=>'WB-GM',3=>'Saturation',4=>'Sharpness',
1036 5=>'Contrast',6=>'Hue',7=>'HighLowKey');
1037 my $t = $v[1] >> 8;
1038 $v[1] = sprintf('%s+%d', $s{$t} || "Unknown($t)", $v[1] & 0xff);
1039 } elsif (defined $v[1]) {
1040 $v[1] = 'No Extended Bracket',
1041 }
1042 return join(' EV, ', @v);
1043 },
1044 PrintConvInv => sub {
1045 my @v = split(/, ?/, shift);
1046 $v[0] =~ s/ ?EV//i;
1047 if ($v[1]) {
1048 my %s = ('WB-BA'=>1,'WB-GM'=>2,'Saturation'=>3,'Sharpness'=>4,
1049 'Contrast'=>5,'Hue'=>6,'HighLowKey'=>7);
1050 if ($v[1] =~ /^No\b/i) {
1051 $v[1] = 0;
1052 } elsif ($v[1] =~ /Unknown\((\d+)\)\+(\d+)/i) {
1053 $v[1] = ($1 << 8) + $2;
1054 } elsif ($v[1] =~ /([\w-]+)\+(\d+)/ and $s{$1}) {
1055 $v[1] = ($s{$1} << 8) + $2;
1056 } else {
1057 warn "Bad extended bracket\n";
1058 }
1059 }
1060 return "@v";
1061 },
1062 },
1063 0x0019 => { #3
1064 Name => 'WhiteBalance',
1065 Writable => 'int16u',
1066 PrintConvColumns => 2,
1067 PrintConv => {
1068 0 => 'Auto',
1069 1 => 'Daylight',
1070 2 => 'Shade',
1071 3 => 'Fluorescent', #2
1072 4 => 'Tungsten',
1073 5 => 'Manual',
1074 6 => 'Daylight Fluorescent', #13
1075 7 => 'Day White Fluorescent', #13
1076 8 => 'White Fluorescent', #13
1077 9 => 'Flash', #13
1078 10 => 'Cloudy', #13
1079 15 => 'Color Temperature Enhancement', #PH
1080 17 => 'Kelvin', #PH
1081 0xfffe => 'Unknown', #13
1082 0xffff => 'User-Selected', #13
1083 },
1084 },
1085 0x001a => { #5
1086 Name => 'WhiteBalanceMode',
1087 Writable => 'int16u',
1088 PrintConv => {
1089 1 => 'Auto (Daylight)',
1090 2 => 'Auto (Shade)',
1091 3 => 'Auto (Flash)',
1092 4 => 'Auto (Tungsten)',
1093 6 => 'Auto (Daylight Fluorescent)', #19 (NC)
1094 7 => 'Auto (Day White Fluorescent)', #17 (K100D guess)
1095 8 => 'Auto (White Fluorescent)', #17 (K100D guess)
1096 10 => 'Auto (Cloudy)', #17 (K100D guess)
1097 # 0xfffd observed in K100D (ref 17)
1098 0xfffe => 'Unknown', #PH (you get this when shooting night sky shots)
1099 0xffff => 'User-Selected',
1100 },
1101 },
1102 0x001b => { #6
1103 Name => 'BlueBalance',
1104 Writable => 'int16u',
1105 ValueConv => '$val / 256',
1106 ValueConvInv => 'int($val * 256 + 0.5)',
1107 },
1108 0x001c => { #6
1109 Name => 'RedBalance',
1110 Writable => 'int16u',
1111 ValueConv => '$val / 256',
1112 ValueConvInv => 'int($val * 256 + 0.5)',
1113 },
1114 0x001d => [
1115 # Would be nice if there was a general way to determine units for FocalLength...
1116 {
1117 # Optio 30, 33WR, 43WR, 450, 550, 555, 750Z, X
1118 Name => 'FocalLength',
1119 Condition => '$self->{Model} =~ /^PENTAX Optio (30|33WR|43WR|450|550|555|750Z|X)\b/',
1120 Writable => 'int32u',
1121 Priority => 0,
1122 ValueConv => '$val / 10',
1123 ValueConvInv => '$val * 10',
1124 PrintConv => 'sprintf("%.1f mm",$val)',
1125 PrintConvInv => '$val=~s/\s*mm//;$val',
1126 },
1127 {
1128 # K100D, Optio 230, 330GS, 33L, 33LF, A10, M10, MX, MX4, S, S30,
1129 # S4, S4i, S5i, S5n, S5z, S6, S45, S50, S55, S60, SV, Svi, W10, WP,
1130 # *ist D, DL, DL2, DS, DS2
1131 # (Note: the Optio S6 seems to report the minimum focal length - PH)
1132 Name => 'FocalLength',
1133 Writable => 'int32u',
1134 Priority => 0,
1135 ValueConv => '$val / 100',
1136 ValueConvInv => '$val * 100',
1137 PrintConv => 'sprintf("%.1f mm",$val)',
1138 PrintConvInv => '$val=~s/\s*mm//;$val',
1139 },
1140 ],
1141 0x001e => { #3
1142 Name => 'DigitalZoom',
1143 Writable => 'int16u',
1144 ValueConv => '$val / 100', #14
1145 ValueConvInv => '$val * 100', #14
1146 },
1147 0x001f => {
1148 Name => 'Saturation',
1149 Writable => 'int16u',
1150 Count => -1,
1151 Notes => '1 or 2 values',
1152 PrintConvColumns => 2,
1153 PrintConv => [{ # the *istD has pairs of values - PH
1154 0 => 'Low', #PH
1155 1 => 'Normal', #PH
1156 2 => 'High', #PH
1157 3 => 'Med Low', #2
1158 4 => 'Med High', #2
1159 5 => 'Very Low', #(NC)
1160 6 => 'Very High', #(NC)
1161 7 => '-4', #PH (K-5)
1162 8 => '+4', #PH (NC)
1163 65535 => 'None', #PH (Monochrome)
1164 }],
1165 },
1166 0x0020 => {
1167 Name => 'Contrast',
1168 Writable => 'int16u',
1169 Count => -1,
1170 Notes => '1 or 2 values',
1171 PrintConvColumns => 2,
1172 PrintConv => [{ # the *istD has pairs of values - PH
1173 0 => 'Low', #PH
1174 1 => 'Normal', #PH
1175 2 => 'High', #PH
1176 3 => 'Med Low', #2
1177 4 => 'Med High', #2
1178 5 => 'Very Low', #PH
1179 6 => 'Very High', #PH (NC)
1180 7 => '-4', #PH (NC)
1181 8 => '+4', #PH (K-5)
1182 }],
1183 },
1184 0x0021 => {
1185 Name => 'Sharpness',
1186 Writable => 'int16u',
1187 Count => -1,
1188 Notes => '1 or 2 values',
1189 PrintConvColumns => 2,
1190 PrintConv => [{ # the *istD has pairs of values - PH
1191 0 => 'Soft', #PH
1192 1 => 'Normal', #PH
1193 2 => 'Hard', #PH
1194 3 => 'Med Soft', #2
1195 4 => 'Med Hard', #2
1196 5 => 'Very Soft', #(NC)
1197 6 => 'Very Hard', #(NC)
1198 7 => '-4', #PH (NC)
1199 8 => '+4', #PH (NC)
1200 }],
1201 },
1202 0x0022 => { #PH
1203 Name => 'WorldTimeLocation',
1204 Groups => { 2 => 'Time' },
1205 Writable => 'int16u',
1206 PrintConv => {
1207 0 => 'Hometown',
1208 1 => 'Destination',
1209 },
1210 },
1211 0x0023 => { #PH
1212 Name => 'HometownCity',
1213 Groups => { 2 => 'Time' },
1214 Writable => 'int16u',
1215 SeparateTable => 'City',
1216 PrintConv => \%pentaxCities,
1217 },
1218 0x0024 => { #PH
1219 Name => 'DestinationCity',
1220 Groups => { 2 => 'Time' },
1221 Writable => 'int16u',
1222 SeparateTable => 'City',
1223 PrintConv => \%pentaxCities,
1224 },
1225 0x0025 => { #PH
1226 Name => 'HometownDST',
1227 Groups => { 2 => 'Time' },
1228 Writable => 'int16u',
1229 PrintConv => { 0 => 'No', 1 => 'Yes' },
1230 },
1231 0x0026 => { #PH
1232 Name => 'DestinationDST',
1233 Groups => { 2 => 'Time' },
1234 Writable => 'int16u',
1235 PrintConv => { 0 => 'No', 1 => 'Yes' },
1236 },
1237 0x0027 => { #PH
1238 Name => 'DSPFirmwareVersion',
1239 Writable => 'undef',
1240 # - for K10D, this comes from 4 bytes at offset 0x1c in the firmware file
1241 %pentaxFirmwareID,
1242 },
1243 0x0028 => { #PH
1244 Name => 'CPUFirmwareVersion',
1245 Writable => 'undef',
1246 # - for K10D, this comes from 4 bytes at offset 0x83fbf8 in firmware file
1247 %pentaxFirmwareID,
1248 },
1249 0x0029 => { #5
1250 Name => 'FrameNumber',
1251 # - one report that this has a value of 84 for the first image with a *istDS
1252 # - another report that file number 4 has frameNumber 154 for *istD, and
1253 # that framenumber jumped at about 9700 to around 26000
1254 # - with *istDS firmware 2.0, this tag was removed and ShutterCount was added
1255 Writable => 'int32u',
1256 },
1257 # 0x002b - definitely exposure related somehow - PH
1258 0x002d => { #PH
1259 Name => 'EffectiveLV',
1260 Notes => 'camera-calculated light value, but includes exposure compensation',
1261 Writable => 'int16u',
1262 ValueConv => '$val/1024',
1263 ValueConvInv => '$val * 1024',
1264 PrintConv => 'sprintf("%.1f",$val)',
1265 PrintConvInv => '$val',
1266 },
1267 0x0032 => { #13
1268 Name => 'ImageEditing',
1269 Writable => 'undef',
1270 Format => 'int8u',
1271 Count => 4,
1272 PrintConv => {
1273 '0 0' => 'None', #PH
1274 '0 0 0 0' => 'None',
1275 '0 0 0 4' => 'Digital Filter',
1276 '1 0 0 0' => 'Resized', #PH (K-5)
1277 '2 0 0 0' => 'Cropped', #PH
1278 # note: doesn't apply to digital filters applied when picture is taken
1279 '4 0 0 0' => 'Digital Filter 4', #PH (K10D)
1280 '6 0 0 0' => 'Digital Filter 6', #PH (K-5)
1281 '16 0 0 0' => 'Frame Synthesis?',
1282 },
1283 },
1284 0x0033 => { #PH (K110D/K100D/K-m)
1285 Name => 'PictureMode',
1286 Writable => 'int8u',
1287 Count => 3,
1288 Relist => [ [0, 1], 2 ], # join values 0 and 1 for PrintConv
1289 PrintConvColumns => 2,
1290 PrintConv => [{
1291 # Program dial modes (from K110D)
1292 '0 0' => 'Program', # (also on K10D, custom settings: Program Line 1, e-dial in Program 3, 4 or 5)
1293 '0 1' => 'Hi-speed Program', #19 (K10D, custom settings: Program Line 2, e-dial in Program 3, 4 or 5)
1294 '0 2' => 'DOF Program', #19 (K10D, custom settings: Program Line 3, e-dial in Program 3, 4 or 5)
1295 '0 3' => 'MTF Program', #19 (K10D, custom settings: Program Line 4, e-dial in Program 3, 4 or 5)
1296 '0 4' => 'Standard', #13
1297 '0 5' => 'Portrait',
1298 '0 6' => 'Landscape',
1299 '0 7' => 'Macro',
1300 '0 8' => 'Sport',
1301 '0 9' => 'Night Scene Portrait',
1302 '0 10' => 'No Flash',
1303 # SCN modes (menu-selected) (from K100D)
1304 '0 11' => 'Night Scene',
1305 '0 12' => 'Surf & Snow',
1306 '0 13' => 'Text',
1307 '0 14' => 'Sunset',
1308 '0 15' => 'Kids',
1309 '0 16' => 'Pet',
1310 '0 17' => 'Candlelight',
1311 '0 18' => 'Museum',
1312 '0 19' => 'Food', #(n/c)
1313 '0 20' => 'Stage Lighting',
1314 '0 21' => 'Night Snap',
1315 # AUTO PICT modes (auto-selected)
1316 '1 4' => 'Auto PICT (Standard)', #13
1317 '1 5' => 'Auto PICT (Portrait)', #7 (K100D)
1318 '1 6' => 'Auto PICT (Landscape)', # K110D
1319 '1 7' => 'Auto PICT (Macro)', #13
1320 '1 8' => 'Auto PICT (Sport)', #13
1321 # *istD modes (ref 7)
1322 '2 0' => 'Program (HyP)', #13 (K-5 Normal program line - PH)
1323 '2 1' => 'Hi-speed Program (HyP)', #19 (K10D, custom settings: Program Line 2, e-dial in Program 1, 2)
1324 '2 2' => 'DOF Program (HyP)', #19 (K10D, custom settings: Program Line 3, e-dial in Program 1, 2)
1325 '2 3' => 'MTF Program (HyP)', #19 (K10D, custom settings: Program Line 4, e-dial in Program 1, 2)
1326 '2 22' => 'Shallow DOF (HyP)', #PH (K-5)
1327 '3 0' => 'Green Mode', #16
1328 '4 0' => 'Shutter Speed Priority',
1329 '5 0' => 'Aperture Priority',
1330 '6 0' => 'Program Tv Shift',
1331 '7 0' => 'Program Av Shift', #19
1332 '8 0' => 'Manual',
1333 '9 0' => 'Bulb',
1334 '10 0' => 'Aperture Priority, Off-Auto-Aperture',
1335 '11 0' => 'Manual, Off-Auto-Aperture',
1336 '12 0' => 'Bulb, Off-Auto-Aperture',
1337 # extra K10D modes (ref 16)
1338 '13 0' => 'Shutter & Aperture Priority AE',
1339 '15 0' => 'Sensitivity Priority AE',
1340 '16 0' => 'Flash X-Sync Speed AE',
1341 '18 0' => 'Auto Program (Normal)', #PH (K-5)
1342 '18 1' => 'Auto Program (Hi-speed)', #PH (NC)
1343 '18 2' => 'Auto Program (DOF)', #PH (K-5)
1344 '18 3' => 'Auto Program (MTF)', #PH (NC)
1345 '18 22' => 'Auto Program (Shallow DOF)', #PH (NC)
1346 '254 0' => 'Video', #PH (K-7,K-5)
1347 '255 0' => 'Video (Auto Aperture)', #PH (K-5)
1348 '255 4' => 'Video (4)', #PH (K-x)
1349 },{
1350 # EV step size (ref 19)
1351 0 => '1/2 EV steps',
1352 1 => '1/3 EV steps',
1353 }],
1354 },
1355 0x0034 => { #7/PH
1356 Name => 'DriveMode',
1357 Writable => 'int8u',
1358 Count => 4,
1359 PrintConv => [{
1360 0 => 'Single-frame',
1361 1 => 'Continuous', # (K-5 Hi)
1362 2 => 'Continuous (Lo)', #PH (K-5)
1363 3 => 'Burst', #PH (K20D)
1364 255 => 'Video', #PH (K-x)
1365 # (K20D also has an Interval mode that needs decoding)
1366 },{
1367 0 => 'No Timer',
1368 1 => 'Self-timer (12 s)',
1369 2 => 'Self-timer (2 s)',
1370 16 => 'Mirror Lock-up', # (K-5)
1371 255 => 'n/a', #PH (K-x)
1372 },{
1373 0 => 'Shutter Button', # (also computer remote control - PH)
1374 1 => 'Remote Control (3 s delay)', #19
1375 2 => 'Remote Control', #19
1376 4 => 'Remote Continuous Shooting', # (K-5)
1377 },{
1378 0x00 => 'Single Exposure',
1379 0x01 => 'Multiple Exposure',
1380 0x10 => 'HDR', #PH (645D)
1381 0x20 => 'HDR Strong 1', #PH (NC) (K-5)
1382 0x30 => 'HDR Strong 2', #PH (K-5)
1383 0x40 => 'HDR Strong 3', #PH (K-5)
1384 0xe0 => 'HDR Auto', #PH (K-5)
1385 0xff => 'Video', #PH (K-x)
1386 }],
1387 },
1388 0x0035 => { #PH
1389 Name => 'SensorSize',
1390 Format => 'int16u',
1391 Count => 2,
1392 Notes => 'includes masked pixels',
1393 # values for various models (not sure why this is in 2um increments):
1394 # 11894 7962 (K10D,K-m) 12012 7987 (*istDS,K100D,K110D) 12012 8019 (*istD),
1395 # 12061 7988 (K-5) 12053 8005 (K-r,K-x) 14352 9535 (K20D,K-7)
1396 # 22315 16711 (645)
1397 ValueConv => 'my @a=split(" ",$val); $_/=500 foreach @a; join(" ",@a)',
1398 ValueConvInv => 'my @a=split(" ",$val); $_*=500 foreach @a; join(" ",@a)',
1399 PrintConv => 'sprintf("%.3f x %.3f mm", split(" ",$val))',
1400 PrintConvInv => '$val=~s/\s*mm$//; $val=~s/\s*x\s*/ /; $val',
1401 },
1402 0x0037 => { #13
1403 Name => 'ColorSpace',
1404 Writable => 'int16u',
1405 PrintConv => {
1406 0 => 'sRGB',
1407 1 => 'Adobe RGB',
1408 },
1409 },
1410 0x0038 => { #5 (PEF only)
1411 Name => 'ImageAreaOffset',
1412 Writable => 'int16u',
1413 Count => 2,
1414 },
1415 0x0039 => { #PH
1416 Name => 'RawImageSize',
1417 Writable => 'int16u',
1418 Count => 2,
1419 PrintConv => '$_=$val;s/ /x/;$_',
1420 },
1421 0x003c => { #7/PH
1422 Name => 'AFPointsInFocus',
1423 # not writable because I'm not decoding these 4 bytes fully:
1424 # Nibble pattern: XSSSYUUU
1425 # X = unknown (AF focused flag?, 0 or 1)
1426 # SSS = selected AF point bitmask (0x000 or 0x7ff if unused)
1427 # Y = unknown (observed 0,6,7,b,e, always 0 if SSS is 0x000 or 0x7ff)
1428 # UUU = af points used
1429 Format => 'int32u',
1430 Notes => '*istD only',
1431 ValueConv => '$val & 0x7ff', # ignore other bits for now
1432 PrintConvColumns => 2,
1433 PrintConv => { BITMASK => {
1434 0 => 'Upper-left',
1435 1 => 'Top',
1436 2 => 'Upper-right',
1437 3 => 'Left',
1438 4 => 'Mid-left',
1439 5 => 'Center',
1440 6 => 'Mid-right',
1441 7 => 'Right',
1442 8 => 'Lower-left',
1443 9 => 'Bottom',
1444 10 => 'Lower-right',
1445 } },
1446 },
1447 # 0x003d - int16u: 8192 for most images, but occasionally 11571 for K100D/K110D,
1448 # and 8289 or 8456 for the K-x - PH
1449 0x003e => { #PH
1450 Name => 'PreviewImageBorders',
1451 Writable => 'int8u',
1452 Count => 4,
1453 Notes => 'top, bottom, left, right',
1454 },
1455 0x003f => { #PH
1456 Name => 'LensType',
1457 Writable => 'int8u',
1458 Count => 2,
1459 SeparateTable => 1,
1460 # the K-m adds two zeros to the LensType, some other models add only 1
1461 ValueConv => '$val=~s/^(\d+ \d+)( 0){1,2}$/$1/; $val',
1462 ValueConvInv => '$val',
1463 PrintConv => \%pentaxLensTypes,
1464 },
1465 0x0040 => { #PH
1466 Name => 'SensitivityAdjust',
1467 Writable => 'int16u',
1468 ValueConv => '($val - 50) / 10',
1469 ValueConvInv => '$val * 10 + 50',
1470 PrintConv => '$val ? sprintf("%+.1f", $val) : 0',
1471 PrintConvInv => '$val',
1472 },
1473 0x0041 => { #19
1474 Name => 'ImageEditCount',
1475 Writable => 'int16u',
1476 },
1477 0x0047 => { #PH
1478 Name => 'CameraTemperature',
1479 Writable => 'int8s',
1480 PrintConv => '"$val C"',
1481 PrintConvInv => '$val=~s/ ?c$//i; $val',
1482 },
1483 0x0048 => { #19
1484 Name => 'AELock',
1485 Writable => 'int16u',
1486 PrintConv => {
1487 0 => 'Off',
1488 1 => 'On',
1489 },
1490 },
1491 0x0049 => { #13
1492 Name => 'NoiseReduction',
1493 Writable => 'int16u',
1494 PrintConv => { 0 => 'Off', 1 => 'On' },
1495 },
1496 0x004d => { #PH
1497 Name => 'FlashExposureComp',
1498 Writable => 'int32s',
1499 ValueConv => '$val / 256',
1500 ValueConvInv => 'int($val * 256 + ($val > 0 ? 0.5 : -0.5))',
1501 PrintConv => '$val ? sprintf("%+.1f", $val) : 0',
1502 PrintConvInv => 'Image::ExifTool::Exif::ConvertFraction($val)',
1503 },
1504 0x004f => { #PH
1505 Name => 'ImageTone', # (Called CustomImageMode in K20D manual)
1506 Writable => 'int16u',
1507 PrintConvColumns => 2,
1508 PrintConv => {
1509 0 => 'Natural',
1510 1 => 'Bright',
1511 2 => 'Portrait', # (K20D/K200D)
1512 3 => 'Landscape', # (K20D)
1513 4 => 'Vibrant', # (K20D)
1514 5 => 'Monochrome', # (K20D)
1515 6 => 'Muted', # (645D)
1516 7 => 'Reversal Film', # (645D)
1517 8 => 'Bleach Bypass', # (K-5)
1518 },
1519 },
1520 0x0050 => { #PH
1521 Name => 'ColorTemperature',
1522 Writable => 'int16u',
1523 RawConv => '$val ? $val : undef',
1524 ValueConv => '53190 - $val',
1525 ValueConvInv => '53190 - $val',
1526 },
1527 # 0x0053-0x005a - not in JPEG images - PH
1528 0x005c => { #PH
1529 Name => 'ShakeReductionInfo',
1530 Format => 'undef', # (written as int8u) - do this just to save time converting the value
1531 SubDirectory => { TagTable => 'Image::ExifTool::Pentax::SRInfo' },
1532 },
1533 0x005d => { #JD/PH
1534 # (used by all Pentax DSLR's except *istD and *istDS until firmware 2.0 - PH)
1535 # Observed values for the first shot of a new K10D are: 81 [PH], 181 [19],
1536 # 246 [7], and 209 [18 (one of the first 20 shots)], so there must be a number
1537 # of test images shot in the factory. (But my new K-5 started at 1 - PH)
1538 # This count includes shutter actuations even if they don't result in a
1539 # recorded image (ie. manual white balance frame or digital preview), but
1540 # does not include actuations due to Live View or video recording - PH
1541 Name => 'ShutterCount',
1542 Writable => 'undef',
1543 Count => 4,
1544 Notes => q{
1545 Note: May be reset by servicing! Also, does not include shutter actuations
1546 for live view or video recording
1547 },
1548 # raw value is a big-endian 4-byte integer, encrypted using Date and Time
1549 RawConv => 'length($val) == 4 ? unpack("N",$val) : undef',
1550 RawConvInv => q{
1551 my $val = Image::ExifTool::Pentax::CryptShutterCount($val,$self);
1552 return pack('N', $val);
1553 },
1554 ValueConv => \&CryptShutterCount,
1555 ValueConvInv => '$val',
1556 },
1557 0x0060 => { #PH (K-5)
1558 Name => 'FaceInfo',
1559 Format => 'undef', # (written as int8u)
1560 SubDirectory => { TagTable => 'Image::ExifTool::Pentax::FaceInfo' },
1561 },
1562 # 0x0062 - int16u: 1 (K10D,K200D,K-m,K2000), 3 (K20D), 4 (K-7), 5 (K-x), 6 (645D), 7 (K-r), 8 (K-5)
1563 0x0067 => { #PH (K-5)
1564 Name => 'Hue',
1565 Writable => 'int16u',
1566 PrintConvColumns => 2,
1567 PrintConv => {
1568 0 => -2,
1569 1 => 'Normal',
1570 2 => 2,
1571 3 => -1,
1572 4 => 1,
1573 5 => -3,
1574 6 => 3,
1575 7 => -4,
1576 8 => 4,
1577 65535 => 'None', # (Monochrome)
1578 },
1579 },
1580 # 0x0067 - int16u: 1 [and 65535 in Monochrome] (K20D,K200D) - PH
1581 0x0068 => { #PH
1582 Name => 'AWBInfo',
1583 Format => 'undef', # (written as int8u)
1584 SubDirectory => { TagTable => 'Image::ExifTool::Pentax::AWBInfo' },
1585 },
1586 0x0069 => { #PH (K20D; K-5 highlights only)
1587 Name => 'DynamicRangeExpansion',
1588 Writable => 'undef',
1589 Format => 'int8u',
1590 Count => 4,
1591 PrintConv => {
1592 '0 0 0 0' => 'Off',
1593 '1 0 0 0' => 'On',
1594 },
1595 },
1596 0x006b => { #PH (K-5)
1597 Name => 'TimeInfo',
1598 Format => 'undef', # (written as int8u)
1599 SubDirectory => { TagTable => 'Image::ExifTool::Pentax::TimeInfo' },
1600 },
1601 0x006c => { #PH (K-5)
1602 Name => 'HighLowKeyAdj',
1603 Description => 'High/Low Key Adj',
1604 Writable => 'int16s',
1605 Count => 2,
1606 PrintConvColumns => 3,
1607 PrintConv => {
1608 '-4 0' => -4,
1609 '-3 0' => -3,
1610 '-2 0' => -2,
1611 '-1 0' => -1,
1612 '0 0' => 0,
1613 '1 0' => 1,
1614 '2 0' => 2,
1615 '3 0' => 3,
1616 '4 0' => 4,
1617 },
1618 },
1619 0x006d => { #PH (K-5)
1620 Name => 'ContrastHighlight',
1621 Writable => 'int16s',
1622 Count => 2,
1623 PrintConvColumns => 3,
1624 PrintConv => {
1625 '-4 0' => -4,
1626 '-3 0' => -3,
1627 '-2 0' => -2,
1628 '-1 0' => -1,
1629 '0 0' => 0,
1630 '1 0' => 1,
1631 '2 0' => 2,
1632 '3 0' => 3,
1633 '4 0' => 4,
1634 },
1635 },
1636 0x006e => { #PH (K-5)
1637 Name => 'ContrastShadow',
1638 Writable => 'int16s',
1639 Count => 2,
1640 PrintConvColumns => 3,
1641 PrintConv => {
1642 '-4 0' => -4,
1643 '-3 0' => -3,
1644 '-2 0' => -2,
1645 '-1 0' => -1,
1646 '0 0' => 0,
1647 '1 0' => 1,
1648 '2 0' => 2,
1649 '3 0' => 3,
1650 '4 0' => 4,
1651 },
1652 },
1653 0x006f => { #PH (K-5)
1654 Name => 'ContrastHighlightShadowAdj',
1655 Description => 'Contrast Highlight/Shadow Adj',
1656 Writable => 'int8u',
1657 PrintConv => {
1658 0 => 'Off',
1659 1 => 'On',
1660 },
1661 },
1662 0x0070 => { #PH (K-5)
1663 Name => 'FineSharpness',
1664 Writable => 'int8u',
1665 Count => -1, # 1 for K20/K200, 2 for K-5
1666 PrintConv => [{
1667 0 => 'Off',
1668 1 => 'On',
1669 },{
1670 0 => 'Normal',
1671 2 => 'Extra fine',
1672 }],
1673 },
1674 0x0071 => { #PH (K20D,K-x)
1675 Name => 'HighISONoiseReduction',
1676 Format => 'int8u',
1677 PrintConv => [{
1678 0 => 'Off',
1679 1 => 'Weakest',
1680 2 => 'Weak', # (called "Low" by K-x)
1681 3 => 'Strong', # (called "High" by K-x)
1682 4 => 'Medium',
1683 255 => 'Auto', # (K-5)
1684 },{
1685 0 => 'Inactive',
1686 1 => 'Active',
1687 2 => 'Active (Weak)', # (K-5)
1688 3 => 'Active (Strong)', # (K-5)
1689 4 => 'Active (Medium)', # (K-5)
1690 },{ # Start ISO level for NR (K-x)
1691 48 => 'ISO>400',
1692 56 => 'ISO>800',
1693 64 => 'ISO>1600',
1694 72 => 'ISO>3200',
1695 }],
1696 },
1697 0x0072 => { #JD (K20D)
1698 Name => 'AFAdjustment',
1699 Writable => 'int16s',
1700 },
1701 0x0073 => { #PH (K-5)
1702 Name => 'MonochromeFilterEffect',
1703 Writable => 'int16u',
1704 PrintConvColumns => 2,
1705 PrintConv => {
1706 65535 => 'None',
1707 1 => 'Green',
1708 2 => 'Yellow',
1709 3 => 'Orange',
1710 4 => 'Red',
1711 5 => 'Magenta',
1712 6 => 'Blue',
1713 7 => 'Cyan',
1714 8 => 'Infrared',
1715 },
1716 },
1717 0x0074 => { #PH (K-5)
1718 Name => 'MonochromeToning',
1719 Writable => 'int16u',
1720 PrintConvColumns => 2,
1721 PrintConv => {
1722 65535 => 'None',
1723 0 => -4,
1724 1 => -3,
1725 2 => -2,
1726 3 => -1,
1727 4 => 0,
1728 5 => 1,
1729 6 => 2,
1730 7 => 3,
1731 8 => 4,
1732 },
1733 },
1734 0x0076 => { #PH (K-5)
1735 Name => 'FaceDetect',
1736 Writable => 'int8u',
1737 Count => 2,
1738 # the Optio S12 writes this but not the FacesDetected tag, so get FacesDetected from here
1739 DataMember => 'FacesDetected',
1740 RawConv => '$val =~ / (\d+)/ and $$self{FacesDetected} = $1; $val',
1741 PrintConv => [
1742 '$val ? "On ($val faces max)" : "Off"',
1743 '"$val faces detected"',
1744 ],
1745 PrintConvInv => [
1746 '$val =~ /(\d+)/ ? $1 : 0',
1747 '$val =~ /(\d+)/ ? $1 : 0',
1748 ],
1749 },
1750 0x0077 => { #PH (K-5)
1751 # set by taking a picture with face detect AF,
1752 # but it isn't reset until camera is turned off? - PH
1753 Name => 'FaceDetectFrameSize',
1754 Writable => 'int16u',
1755 Count => 2,
1756 },
1757 # 0x0078 - int16u[2]: '0 0' (K-5,K-7,K-r,K-x)
1758 0x0079 => { #PH
1759 Name => 'ShadowCompensation',
1760 Writable => 'int8u',
1761 Count => -1,
1762 PrintConvColumns => 2,
1763 PrintConv => {
1764 # (1 value for K-m/K2000, 2 for 645D)
1765 0 => 'Off',
1766 1 => 'On',
1767 '0 0' => 'Off',
1768 '1 1' => 'Weak',
1769 '1 2' => 'Normal',
1770 '1 3' => 'Strong',
1771 },
1772 },
1773 0x007a => { #PH
1774 Name => 'ISOAutoParameters',
1775 Writable => 'int8u',
1776 Count => 2,
1777 PrintConv => {
1778 '1 0' => 'Slow',
1779 '2 0' => 'Standard',
1780 '3 0' => 'Fast',
1781 },
1782 },
1783 0x007b => { #PH (K-5)
1784 Name => 'CrossProcess',
1785 Writable => 'int8u',
1786 PrintConvColumns => 2,
1787 PrintConv => {
1788 0 => 'Off',
1789 1 => 'Random',
1790 2 => 'Preset 1',
1791 3 => 'Preset 2',
1792 4 => 'Preset 3',
1793 33 => 'Favorite 1',
1794 34 => 'Favorite 2',
1795 35 => 'Favorite 3',
1796 },
1797 },
1798 0x007d => { #PH
1799 Name => 'LensCorr',
1800 Format => 'undef', # (written as int8u)
1801 SubDirectory => { TagTable => 'Image::ExifTool::Pentax::LensCorr' },
1802 },
1803 # 0x007e - int32u: 15859,15860,15864,15865,16315 (K-5 PEF/DNG only) - PH
1804 0x007f => { #PH (K-5)
1805 Name => 'BleachBypassToning',
1806 Writable => 'int16u',
1807 PrintConvColumns => 2,
1808 PrintConv => {
1809 65535 => 'Off',
1810 1 => 'Green',
1811 2 => 'Yellow',
1812 3 => 'Orange',
1813 4 => 'Red',
1814 5 => 'Magenta',
1815 6 => 'Purple',
1816 7 => 'Blue',
1817 8 => 'Cyan',
1818 },
1819 },
1820 0x0200 => { #5
1821 Name => 'BlackPoint',
1822 Writable => 'int16u',
1823 Count => 4,
1824 },
1825 0x0201 => { #5
1826 # (this doesn't change for different fixed white balances in JPEG images: Daylight,
1827 # Tungsten, Kelvin, etc -- always "8192 8192 8192 8192", but it varies for these in
1828 # RAW images, all images in Auto, for different Manual WB settings, and for images
1829 # taken via Pentax Remote Assistant) - PH
1830 Name => 'WhitePoint',
1831 Writable => 'int16u',
1832 Count => 4,
1833 },
1834 # 0x0202: int16u[4]: all 0's in all my samples
1835 0x0203 => { #JD (not really sure what these mean)
1836 Name => 'ColorMatrixA',
1837 Writable => 'int16s',
1838 Count => 9,
1839 ValueConv => 'join(" ",map({ $_/8192 } split(" ",$val)))',
1840 ValueConvInv => 'join(" ",map({ int($_*8192 + ($_<0?-0.5:0.5)) } split(" ",$val)))',
1841 PrintConv => 'join(" ",map({sprintf("%.5f",$_)} split(" ",$val)))',
1842 PrintConvInv => '"$val"',
1843 },
1844 0x0204 => { #JD
1845 Name => 'ColorMatrixB',
1846 Writable => 'int16s',
1847 Count => 9,
1848 ValueConv => 'join(" ",map({ $_/8192 } split(" ",$val)))',
1849 ValueConvInv => 'join(" ",map({ int($_*8192 + ($_<0?-0.5:0.5)) } split(" ",$val)))',
1850 PrintConv => 'join(" ",map({sprintf("%.5f",$_)} split(" ",$val)))',
1851 PrintConvInv => '"$val"',
1852 },
1853 0x0205 => { #19
1854 Name => 'CameraSettings',
1855 SubDirectory => {
1856 TagTable => 'Image::ExifTool::Pentax::CameraSettings',
1857 ByteOrder => 'BigEndian',
1858 },
1859 },
1860 0x0206 => { #PH
1861 Name => 'AEInfo',
1862 SubDirectory => { TagTable => 'Image::ExifTool::Pentax::AEInfo' },
1863 },
1864 0x0207 => [ #PH
1865 {
1866 Name => 'LensInfo',
1867 # the *ist series (and Samsung GX-1) always use the old format, and all
1868 # other models but the K100D, K110D and K100D Super always use the newer
1869 # format, and for the K110D/K110D we expect ff or 00 00 at byte 20 if
1870 # it is the old format.)
1871 Condition => q{
1872 $$self{Model}=~/(\*ist|GX-1[LS])/ or
1873 ($$self{Model}=~/(K100D|K110D)/ and $$valPt=~/^.{20}(\xff|\0\0)/s)
1874 },
1875 SubDirectory => { TagTable => 'Image::ExifTool::Pentax::LensInfo' },
1876 },{
1877 Name => 'LensInfo',
1878 Condition => '$count < 90',
1879 SubDirectory => { TagTable => 'Image::ExifTool::Pentax::LensInfo2' },
1880 },{
1881 Name => 'LensInfo',
1882 Condition => '$count == 90',
1883 SubDirectory => { TagTable => 'Image::ExifTool::Pentax::LensInfo3' },
1884 },{
1885 Name => 'LensInfo',
1886 SubDirectory => { TagTable => 'Image::ExifTool::Pentax::LensInfo4' },
1887 }
1888 ],
1889 0x0208 => [ #PH
1890 {
1891 Name => 'FlashInfo',
1892 Condition => '$count == 27',
1893 SubDirectory => { TagTable => 'Image::ExifTool::Pentax::FlashInfo' },
1894 },
1895 {
1896 Name => 'FlashInfoUnknown',
1897 SubDirectory => { TagTable => 'Image::ExifTool::Pentax::FlashInfoUnknown' },
1898 },
1899 ],
1900 0x0209 => { #PH
1901 Name => 'AEMeteringSegments',
1902 Format => 'int8u',
1903 Count => -1,
1904 Notes => q{
1905 measurements from each of the 16 AE metering segments for models such as the
1906 K10D, and 77 metering segments for models such as the K-5, converted to LV
1907 },
1908 %convertMeteringSegments,
1909 # 16 metering segment 77 metering segment
1910 # locations (ref JD) locations (ref PH, K-5)
1911 # +-------------------------+
1912 # | 14 | +----------------------------------+
1913 # | +---+---+---+---+ | | 0 1 2 3 4 5 6 7 8 9 10 |
1914 # | | 5 | 3/1\ 2| 4 | | | 11 12 13 14 15 16 17 18 19 20 21 |
1915 # | +-+-+-+-+ - +-+-+-+-+ | | 22 23 24 25 26 27 28 29 30 31 32 |
1916 # +--+ 9 | 7 ||0|| 6 | 8 +--+ | 33 34 35 36 37 38 39 40 41 42 43 |
1917 # | +-+-+-+-+ - +-+-+-+-+ | | 44 45 46 47 48 49 50 51 52 53 54 |
1918 # | |13 |11\ /10|12 | | | 55 56 57 58 59 60 61 62 63 64 65 |
1919 # | +---+---+---+---+ | | 66 67 68 69 70 71 72 73 74 75 76 |
1920 # | 15 | +----------------------------------+
1921 # +-------------------------+
1922 },
1923 0x020a => { #PH/JD/19
1924 Name => 'FlashMeteringSegments',
1925 Format => 'int8u',
1926 Count => -1,
1927 %convertMeteringSegments,
1928 },
1929 0x020b => { #PH/JD/19
1930 Name => 'SlaveFlashMeteringSegments',
1931 Format => 'int8u',
1932 Count => -1,
1933 Notes => 'used in wireless control mode',
1934 %convertMeteringSegments,
1935 },
1936 0x020d => { #PH
1937 Name => 'WB_RGGBLevelsDaylight',
1938 Writable => 'int16u',
1939 Count => 4,
1940 },
1941 0x020e => { #PH
1942 Name => 'WB_RGGBLevelsShade',
1943 Writable => 'int16u',
1944 Count => 4,
1945 },
1946 0x020f => { #PH
1947 Name => 'WB_RGGBLevelsCloudy',
1948 Writable => 'int16u',
1949 Count => 4,
1950 },
1951 0x0210 => { #PH
1952 Name => 'WB_RGGBLevelsTungsten',
1953 Writable => 'int16u',
1954 Count => 4,
1955 },
1956 0x0211 => { #PH
1957 Name => 'WB_RGGBLevelsFluorescentD',
1958 Writable => 'int16u',
1959 Count => 4,
1960 },
1961 0x0212 => { #PH
1962 Name => 'WB_RGGBLevelsFluorescentN',
1963 Writable => 'int16u',
1964 Count => 4,
1965 },
1966 0x0213 => { #PH
1967 Name => 'WB_RGGBLevelsFluorescentW',
1968 Writable => 'int16u',
1969 Count => 4,
1970 },
1971 0x0214 => { #PH
1972 Name => 'WB_RGGBLevelsFlash',
1973 Writable => 'int16u',
1974 Count => 4,
1975 },
1976 0x0215 => { #PH
1977 Name => 'CameraInfo',
1978 Format => 'undef', # (written as int32u)
1979 SubDirectory => { TagTable => 'Image::ExifTool::Pentax::CameraInfo' },
1980 },
1981 0x0216 => { #PH
1982 Name => 'BatteryInfo',
1983 SubDirectory => {
1984 TagTable => 'Image::ExifTool::Pentax::BatteryInfo',
1985 ByteOrder => 'BigEndian', # have seen makernotes changed to little-endian in DNG!
1986 },
1987 },
1988 # 0x021a - undef[1068] (K-5)
1989 0x021b => { #19
1990 Name => 'SaturationInfo',
1991 Flags => [ 'Unknown', 'Binary' ],
1992 Writable => 0,
1993 Notes => 'only in PEF and DNG images',
1994 # K10D values with various Saturation settings (ref 19):
1995 # Very Low: 000000022820f9a0fe4000802660f92002e0fee01e402c40f880fb40ffc02b20f52002e0fe401ee0
1996 # Low: 000000022ae0f700fe20ff402840f88001e0fcc021602f60f560fb40fe602d20f48001c0fbc02280
1997 # Med Low: 000000022dc0f420fe20fe002a20f7e000c0fa8024c032c0f220fb20fce02f60f3c000a0f9202640
1998 # Normal: 000000023120f0e0fe00fc802c40f740ffa0f7e028803660ee80fb20fb4031c0f300ff60f6202a80
1999 # Med High: 0000000234e0ed40fde0fae02ea0f680fe60f5002ca03a80ea80fb00f9603480f220fe00f2e02f20
2000 # High: 0000000238c0e960fde0f9203140f5a0fce0f1e031403f00e600fb00f7803760f120fc60ef403460
2001 # Very High:000000023d20e520fdc0f7203420f4c0fb60ee6036404400e120fae0f5403aa0f020fac0eb403a00
2002 },
2003 # 0x021c - undef[18] (K-5)
2004 # 0x021d - undef[18] (K-5)
2005 # 0x021e - undef[8] (K-5)
2006 0x021f => { #JD
2007 Name => 'AFInfo',
2008 SubDirectory => {
2009 # NOTE: Most of these subdirectories are 'undef' format, and as such the
2010 # byte ordering is not changed when changed via the Pentax software (which
2011 # will write a little-endian TIFF on an Intel system). So we must define
2012 # BigEndian byte ordering for any of these which contain multi-byte values. - PH
2013 ByteOrder => 'BigEndian',
2014 TagTable => 'Image::ExifTool::Pentax::AFInfo',
2015 },
2016 },
2017 0x0220 => { #6
2018 Name => 'HuffmanTable',
2019 Flags => [ 'Unknown', 'Binary' ],
2020 Writable => 0,
2021 Notes => 'found in K10D, K20D and K2000D PEF images',
2022 },
2023 # 0x0221 - undef[138] (K-5)
2024 0x0222 => { #PH
2025 Name => 'ColorInfo',
2026 SubDirectory => { TagTable => 'Image::ExifTool::Pentax::ColorInfo' },
2027 },
2028 # 0x0223 - undef[198] (K-5 PEF/DNG only)
2029 0x0224 => { #19
2030 Name => 'EVStepInfo',
2031 SubDirectory => { TagTable => 'Image::ExifTool::Pentax::EVStepInfo' },
2032 },
2033 0x0226 => { #PH
2034 Name => 'ShotInfo', # (may want to change this later when more is decoded)
2035 SubDirectory => { TagTable => 'Image::ExifTool::Pentax::ShotInfo' },
2036 },
2037 0x0227 => { #PH
2038 Name => 'FacePos',
2039 Condition => '$$self{FacesDetected}', # ignore if no faces to decode
2040 SubDirectory => { TagTable => 'Image::ExifTool::Pentax::FacePos' },
2041 },
2042 0x0228 => { #PH
2043 Name => 'FaceSize',
2044 Condition => '$$self{FacesDetected}', # ignore if no faces to decode
2045 SubDirectory => { TagTable => 'Image::ExifTool::Pentax::FaceSize' },
2046 },
2047 0x0229 => { #PH (verified) (K-m, K-x, K-7)
2048 Name => 'SerialNumber',
2049 Writable => 'string',
2050 Notes => 'left blank by some cameras',
2051 },
2052 0x022a => { #PH (K-5)
2053 Name => 'FilterInfo',
2054 SubDirectory => {
2055 TagTable => 'Image::ExifTool::Pentax::FilterInfo',
2056 ByteOrder => 'BigEndian',
2057 },
2058 },
2059 0x022b => { #PH (K-5)
2060 Name => 'LevelInfo',
2061 SubDirectory => { TagTable => 'Image::ExifTool::Pentax::LevelInfo' },
2062 },
2063 # 0x022c - undef[46] (K-5)
2064 # 0x022d - undef[100] (K-5)
2065 0x022e => { #PH (K-5 AVI videos)
2066 Name => 'Artist',
2067 Groups => { 2 => 'Author' },
2068 Writable => 'string',
2069 },
2070 0x022f => { #PH (K-5 AVI videos)
2071 Name => 'Copyright',
2072 Groups => { 2 => 'Author' },
2073 Writable => 'string',
2074 },
2075 0x0230 => { #PH (K-x AVI videos)
2076 Name => 'FirmwareVersion',
2077 Notes => 'only in AVI videos',
2078 # this tag only exists in AVI videos, and for the K-x the value of
2079 # this tag is "K-x Ver 1.00", which is the same as the EXIF Software
2080 # tag. I used a different tag name for this because Pentax uses the
2081 # AVI Software tag for a different string, "PENTAX K-x".
2082 Writable => 'string',
2083 },
2084 0x0231 => { #PH (K-5)
2085 Name => 'ContrastDetectAFArea',
2086 Writable => 'int16u',
2087 Count => 4,
2088 Notes => q{
2089 AF area of the most recent contrast-detect focus operation. Coordinates
2090 are left, top, width and height in a 720x480 frame, with Y downwards
2091 },
2092 },
2093 0x0235 => { #PH (K-5)
2094 Name => 'CrossProcessParams',
2095 # (it would be interesting to know exactly what these mean)
2096 Writable => 'undef',
2097 Format => 'int8u',
2098 Count => 10,
2099 },
2100 0x03fe => { #PH
2101 Name => 'DataDump',
2102 Writable => 0,
2103 PrintConv => '\$val',
2104 },
2105 0x03ff => [ #PH
2106 {
2107 Name => 'TempInfoK5',
2108 Condition => '$$self{Model} =~ /K-5\b/',
2109 SubDirectory => { TagTable => 'Image::ExifTool::Pentax::TempInfoK5' },
2110 },{
2111 Name => 'UnknownInfo',
2112 SubDirectory => { TagTable => 'Image::ExifTool::Pentax::UnknownInfo' },
2113 },
2114 ],
2115 0x0402 => { #5
2116 Name => 'ToneCurve',
2117 PrintConv => '\$val',
2118 },
2119 0x0403 => { #5
2120 Name => 'ToneCurves',
2121 PrintConv => '\$val',
2122 },
2123 # 0x0404 - undef[2086] (K-5)
2124 # 0x0405 - undef[24200] (K-5 PEF/DNG only)
2125 # 0x0406 - undef[4116] (K-5)
2126 0x0e00 => {
2127 Name => 'PrintIM',
2128 Description => 'Print Image Matching',
2129 Writable => 0,
2130 SubDirectory => {
2131 TagTable => 'Image::ExifTool::PrintIM::Main',
2132 },
2133 },
2134);
2135
2136# shake reduction information (ref PH)
2137%Image::ExifTool::Pentax::SRInfo = (
2138 %binaryDataAttrs,
2139 GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
2140 NOTES => 'Shake reduction information.',
2141 0 => {
2142 Name => 'SRResult',
2143 PrintConv => { #PH/JD
2144 0 => 'Not stabilized',
2145 BITMASK => {
2146 0 => 'Stabilized',
2147 # have seen 1 and 4 for 0.5 and 0.3 sec exposures with NR on and Bit 0 also set - ref 19
2148 # have seen bits 1,2,3,4 in K-5 AVI videos - PH
2149 6 => 'Not ready',
2150 },
2151 },
2152 },
2153 1 => {
2154 Name => 'ShakeReduction',
2155 PrintConv => {
2156 0 => 'Off',
2157 1 => 'On',
2158 4 => 'Off (4)', # (K20D, K200D, K-7, K-5)
2159 5 => 'On (5)', #(guess) (K20D)
2160 # (got 5 for K-5 with HDR [auto-align off only], Composition Adjust, and movie with SR off!)
2161 6 => 'On (Video)', # (K-7)
2162 7 => 'On (7)', #(NC) (K20D, K200D, K-m, K-5)
2163 15 => 'On (15)', # (K20D (with Tamron 10-20mm @ 10mm))
2164 },
2165 },
2166 2 => {
2167 Name => 'SRHalfPressTime',
2168 # (was SR_SWSToSWRTime: SWS=photometering switch, SWR=shutter release switch)
2169 # (from http://www.patentstorm.us/patents/6597867-description.html)
2170 # (here, SR could more accurately mean Shutter Release, not Shake Reduction)
2171 Notes => q{
2172 time from when the shutter button was half pressed to when the shutter was
2173 released, including time for focusing
2174 },
2175 # (constant of 60 determined from times: 2sec=127; 3sec=184,197; 4sec=244,249,243,246 - PH)
2176 ValueConv => '$val / 60',
2177 ValueConvInv => 'my $v=$val*60; $v < 255 ? int($v + 0.5) : 255',
2178 PrintConv => 'sprintf("%.2f s",$val) . ($val > 254.5/60 ? " or longer" : "")',
2179 PrintConvInv => '$val=~tr/0-9.//dc; $val',
2180 },
2181 3 => { #JD
2182 Name => 'SRFocalLength',
2183 ValueConv => '$val & 0x01 ? $val * 4 : $val / 2',
2184 ValueConvInv => '$val <= 127 ? int($val) * 2 : int($val / 4) | 0x01',
2185 PrintConv => '"$val mm"',
2186 PrintConvInv => '$val=~s/\s*mm//;$val',
2187 },
2188);
2189
2190# face detection information (ref PH, K-5)
2191%Image::ExifTool::Pentax::FaceInfo = (
2192 %binaryDataAttrs,
2193 GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
2194 DATAMEMBER => [ 0 ],
2195 0 => {
2196 Name => 'FacesDetected',
2197 RawConv => '$$self{FacesDetected} = $val',
2198 },
2199 2 => {
2200 Name => 'FacePosition',
2201 Notes => q{
2202 X/Y coordinates of the center of the main face in percent of frame size,
2203 with positive Y downwards
2204 },
2205 Format => 'int8u[2]',
2206 },
2207);
2208
2209# automatic white balance settings (ref PH, K-5)
2210%Image::ExifTool::Pentax::AWBInfo = (
2211 %binaryDataAttrs,
2212 GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
2213 # 0 - always 1?
2214 # (data ends here for the K20D, K200D, K-x and K-7)
2215 0 => {
2216 Name => 'WhiteBalanceAutoAdjustment',
2217 PrintConv => {
2218 0 => 'Off',
2219 1 => 'On',
2220 },
2221 },
2222 1 => { # (exists only for K-5)
2223 Name => 'TungstenAWB',
2224 PrintConv => {
2225 0 => 'Subtle Correction',
2226 1 => 'Strong Correction',
2227 },
2228 },
2229);
2230
2231# world time settings (ref PH, K-5)
2232%Image::ExifTool::Pentax::TimeInfo = (
2233 %binaryDataAttrs,
2234 GROUPS => { 0 => 'MakerNotes', 2 => 'Time' },
2235 0.1 => {
2236 Name => 'WorldTimeLocation',
2237 Mask => 0x01,
2238 PrintConv => {
2239 0x00 => 'Hometown',
2240 0x01 => 'Destination',
2241 },
2242 },
2243 0.2 => {
2244 Name => 'HometownDST',
2245 Mask => 0x02,
2246 PrintConv => {
2247 0x00 => 'No',
2248 0x02 => 'Yes',
2249 },
2250 },
2251 0.3 => {
2252 Name => 'DestinationDST',
2253 Mask => 0x04,
2254 PrintConv => {
2255 0x00 => 'No',
2256 0x04 => 'Yes',
2257 },
2258 },
2259 2 => {
2260 Name => 'HometownCity',
2261 SeparateTable => 'City',
2262 PrintConv => \%pentaxCities,
2263 },
2264 3 => {
2265 Name => 'DestinationCity',
2266 SeparateTable => 'City',
2267 PrintConv => \%pentaxCities,
2268 },
2269);
2270
2271# lens distortion correction (ref PH, K-5)
2272%Image::ExifTool::Pentax::LensCorr = (
2273 %binaryDataAttrs,
2274 GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
2275 0 => {
2276 Name => 'DistortionCorrection',
2277 PrintConv => { 0 => 'Off', 1 => 'On' },
2278 },
2279 1 => {
2280 Name => 'ChromaticAberrationCorrection',
2281 PrintConv => { 0 => 'Off', 1 => 'On' },
2282 },
2283);
2284
2285# camera settings (ref 19)
2286%Image::ExifTool::Pentax::CameraSettings = (
2287 %binaryDataAttrs,
2288 GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
2289 PRIORITY => 0,
2290 NOTES => 'Shot information written by Pentax DSLR cameras.',
2291 0 => {
2292 Name => 'PictureMode2',
2293 PrintConv => {
2294 0 => 'Scene Mode', #PH
2295 1 => 'Auto PICT', #PH (NC)
2296 2 => 'Program AE',
2297 3 => 'Green Mode',
2298 4 => 'Shutter Speed Priority',
2299 5 => 'Aperture Priority',
2300 6 => 'Program Tv Shift', #PH
2301 7 => 'Program Av Shift',
2302 8 => 'Manual', #PH
2303 9 => 'Bulb', #PH
2304 10 => 'Aperture Priority, Off-Auto-Aperture', #PH (NC)
2305 11 => 'Manual, Off-Auto-Aperture', #PH
2306 12 => 'Bulb, Off-Auto-Aperture', #PH (NC)
2307 13 => 'Shutter & Aperture Priority AE',
2308 15 => 'Sensitivity Priority AE',
2309 16 => 'Flash X-Sync Speed AE', #PH
2310 },
2311 },
2312 1.1 => {
2313 Name => 'ProgramLine',
2314 # only set to other than Normal when in Program AE mode
2315 Mask => 0x03,
2316 PrintConv => {
2317 0 => 'Normal',
2318 1 => 'Hi Speed',
2319 2 => 'Depth',
2320 3 => 'MTF',
2321 },
2322 },
2323 1.2 => { # (K10D, K-5)
2324 Name => 'EVSteps',
2325 Mask => 0x20,
2326 PrintConv => {
2327 0x00 => '1/2 EV Steps',
2328 0x20 => '1/3 EV Steps',
2329 },
2330 },
2331 1.3 => { # (this bit is set for movies with the K-5 - PH)
2332 Name => 'E-DialInProgram',
2333 # always set even when not in Program AE mode
2334 Mask => 0x40,
2335 PrintConv => {
2336 0x00 => 'Tv or Av',
2337 0x40 => 'P Shift',
2338 },
2339 },
2340 1.4 => { # (K10D, K-5)
2341 Name => 'ApertureRingUse',
2342 # always set even Aperture Ring is in A mode
2343 Mask => 0x80,
2344 PrintConv => {
2345 0x00 => 'Prohibited',
2346 0x80 => 'Permitted',
2347 },
2348 },
2349 2 => {
2350 Name => 'FlashOptions',
2351 Notes => 'the camera flash options settings, set even if the flash is off',
2352 Mask => 0xf0,
2353 ValueConv => '$val>>4',
2354 ValueConvInv => '$val<<4',
2355 # Note: These tags correlate with the FlashMode and InternalFlashMode values,
2356 # and match what is displayed by the Pentax software
2357 PrintConv => {
2358 0 => 'Normal', # (this value can occur in Green Mode) - ref 19
2359 1 => 'Red-eye reduction', # (this value can occur in Green Mode) - ref 19
2360 2 => 'Auto', # (this value can occur in other than Green Mode) - ref 19
2361 3 => 'Auto, Red-eye reduction', #PH (this value can occur in other than Green Mode) - ref 19
2362 5 => 'Wireless (Master)',
2363 6 => 'Wireless (Control)',
2364 8 => 'Slow-sync',
2365 9 => 'Slow-sync, Red-eye reduction',
2366 10 => 'Trailing-curtain Sync'
2367 },
2368 },
2369 2.1 => {
2370 Name => 'MeteringMode2',
2371 Mask => 0x0f,
2372 Notes => 'may not be valid for some models, ie. *ist D',
2373 PrintConv => {
2374 0 => 'Multi-segment',
2375 BITMASK => {
2376 0 => 'Center-weighted average',
2377 1 => 'Spot',
2378 },
2379 },
2380 },
2381 3 => {
2382 Name => 'AFPointMode',
2383 Mask => 0xf0,
2384 PrintConv => {
2385 0x00 => 'Auto',
2386 BITMASK => {
2387 4 => 'Select',
2388 5 => 'Fixed Center',
2389 # have seen bit 6 set in pre-production images (firmware 0.20) - PH
2390 },
2391 },
2392 },
2393 3.1 => {
2394 Name => 'FocusMode2',
2395 Mask => 0x0f,
2396 PrintConv => {
2397 0 => 'Manual',
2398 1 => 'AF-S',
2399 2 => 'AF-C',
2400 3 => 'AF-A', #PH
2401 },
2402 },
2403 4 => {
2404 Name => 'AFPointSelected2',
2405 Format => 'int16u',
2406 PrintConv => {
2407 0 => 'Auto',
2408 BITMASK => {
2409 0 => 'Upper-left',
2410 1 => 'Top',
2411 2 => 'Upper-right',
2412 3 => 'Left',
2413 4 => 'Mid-left',
2414 5 => 'Center',
2415 6 => 'Mid-right',
2416 7 => 'Right',
2417 8 => 'Lower-left',
2418 9 => 'Bottom',
2419 10 => 'Lower-right',
2420 },
2421 },
2422 },
2423 6 => {
2424 Name => 'ISOFloor', #PH
2425 # manual ISO or minimum ISO in Auto ISO mode - PH
2426 ValueConv => 'int(100*exp(Image::ExifTool::Pentax::PentaxEv($val-32)*log(2))+0.5)',
2427 ValueConvInv => 'Image::ExifTool::Pentax::PentaxEvInv(log($val/100)/log(2))+32',
2428 },
2429 7 => {
2430 Name => 'DriveMode2',
2431 PrintConv => {
2432 0 => 'Single-frame',
2433 BITMASK => {
2434 0 => 'Continuous', # (K-5 Hi)
2435 1 => 'Continuous (Lo)', #PH (K-5)
2436 2 => 'Self-timer (12 s)', #PH
2437 3 => 'Self-timer (2 s)', #PH
2438 4 => 'Remote Control (3 s delay)',
2439 5 => 'Remote Control',
2440 6 => 'Exposure Bracket', #PH/19
2441 7 => 'Multiple Exposure',
2442 },
2443 },
2444 },
2445 8 => {
2446 Name => 'ExposureBracketStepSize',
2447 # This is set even when Exposure Bracket is Off (and the K10D
2448 # displays Ò---Ó as the step size when you press the EB button) - DaveN
2449 # because the last value is remembered and if you turn Exposure Bracket
2450 # on the step size goes back to what it was before.
2451 PrintConv => {
2452 3 => '0.3',
2453 4 => '0.5',
2454 5 => '0.7',
2455 8 => '1.0', #PH
2456 11 => '1.3',
2457 12 => '1.5',
2458 13 => '1.7', #(NC)
2459 16 => '2.0', #PH
2460 },
2461 },
2462 9 => { #PH/19
2463 Name => 'BracketShotNumber',
2464 PrintHex => 1,
2465 PrintConv => {
2466 0 => 'n/a',
2467 0x02 => '1 of 2', #PH (K-5)
2468 0x12 => '2 of 2', #PH (K-5)
2469 0x03 => '1 of 3',
2470 0x13 => '2 of 3',
2471 0x23 => '3 of 3',
2472 0x05 => '1 of 5',
2473 0x15 => '2 of 5',
2474 0x25 => '3 of 5',
2475 0x35 => '4 of 5',
2476 0x45 => '5 of 5',
2477 },
2478 },
2479 10 => {
2480 Name => 'WhiteBalanceSet',
2481 Mask => 0xf0,
2482 # Not necessarily the white balance used; for example if the custom menu is set to
2483 # "WB when using flash" -> "2 Flash", then this tag reports the camera setting while
2484 # tag 0x0019 reports Flash if the Flash was used.
2485 PrintConv => {
2486 0 => 'Auto',
2487 16 => 'Daylight',
2488 32 => 'Shade',
2489 48 => 'Cloudy',
2490 64 => 'Daylight Fluorescent',
2491 80 => 'Day White Fluorescent',
2492 96 => 'White Fluorescent',
2493 112 => 'Tungsten',
2494 128 => 'Flash',
2495 144 => 'Manual',
2496 # The three Set Color Temperature settings refer to the 3 preset settings which
2497 # can be saved in the menu (see page 123 of the K10D manual)
2498 192 => 'Set Color Temperature 1',
2499 208 => 'Set Color Temperature 2',
2500 224 => 'Set Color Temperature 3',
2501 },
2502 },
2503 10.1 => {
2504 Name => 'MultipleExposureSet',
2505 Mask => 0x0f,
2506 PrintConv => {
2507 0 => 'Off',
2508 1 => 'On',
2509 },
2510 },
2511 13 => {
2512 Name => 'RawAndJpgRecording',
2513 Condition => '$$self{Model} =~ /(K10D|GX10)\b/',
2514 Notes => 'K10D only',
2515 # this is actually a bit field: - PH
2516 # bit 0=JPEG, bit 2=PEF, bit 3=DNG; high nibble: 0x00=best, 0x20=better, 0x40=good
2517 PrintHex => 1,
2518 PrintConv => {
2519 0x01 => 'JPEG (Best)', #PH
2520 0x04 => 'RAW (PEF, Best)',
2521 0x05 => 'RAW+JPEG (PEF, Best)',
2522 0x08 => 'RAW (DNG, Best)', #PH (NC)
2523 0x09 => 'RAW+JPEG (DNG, Best)', #PH (NC)
2524 0x21 => 'JPEG (Better)', #PH
2525 0x24 => 'RAW (PEF, Better)',
2526 0x25 => 'RAW+JPEG (PEF, Better)', #PH
2527 0x28 => 'RAW (DNG, Better)', #PH
2528 0x29 => 'RAW+JPEG (DNG, Better)', #PH (NC)
2529 0x41 => 'JPEG (Good)',
2530 0x44 => 'RAW (PEF, Good)', #PH (NC)
2531 0x45 => 'RAW+JPEG (PEF, Good)', #PH (NC)
2532 0x48 => 'RAW (DNG, Good)', #PH (NC)
2533 0x49 => 'RAW+JPEG (DNG, Good)',
2534 # have seen values of 0,2,34 for other models (not K10D) - PH
2535 },
2536 },
2537 14.1 => { #PH
2538 Name => 'JpgRecordedPixels',
2539 Condition => '$$self{Model} =~ /(K10D|GX10)\b/',
2540 Notes => 'K10D only',
2541 Mask => 0x03,
2542 PrintConv => {
2543 0 => '10 MP',
2544 1 => '6 MP',
2545 2 => '2 MP',
2546 },
2547 },
2548 14.2 => { #PH (K-5)
2549 Name => 'LinkAEToAFPoint',
2550 Condition => '$$self{Model} =~ /K-5\b/',
2551 Notes => 'K-5 only',
2552 Mask => 0x01,
2553 PrintConv => {
2554 0x00 => 'Off',
2555 0x01 => 'On',
2556 },
2557 },
2558 14.3 => { #PH (K-5)
2559 Name => 'SensitivitySteps',
2560 Condition => '$$self{Model} =~ /K-5\b/',
2561 Notes => 'K-5 only',
2562 Mask => 0x02,
2563 PrintConv => {
2564 0x00 => '1 EV Steps',
2565 0x02 => 'As EV Steps',
2566 },
2567 },
2568 14.4 => { #PH (K-5)
2569 Name => 'ISOAuto',
2570 Condition => '$$self{Model} =~ /K-5\b/',
2571 Notes => 'K-5 only',
2572 Mask => 0x04,
2573 PrintConv => {
2574 0x00 => 'Off',
2575 0x04 => 'On',
2576 },
2577 },
2578 # 14.5 Mask 0x80 - changes for K-5
2579 16 => {
2580 Name => 'FlashOptions2',
2581 Condition => '$$self{Model} =~ /(K10D|GX10)\b/',
2582 Notes => 'K10D only; set even if the flash is off',
2583 Mask => 0xf0,
2584 # Note: the Normal and Auto values (0x00 to 0x30) do not tags always
2585 # correlate with the FlashMode, InternalFlashMode and FlashOptions values
2586 # however, these values seem to better match the K10D's actual functionality
2587 # (always Auto in Green mode always Normal otherwise if one of the other options
2588 # isn't selected) - ref 19
2589 # (these tags relate closely to InternalFlashMode values - PH)
2590 PrintConv => {
2591 0x00 => 'Normal', # (this value never occurs in Green Mode) - ref 19
2592 0x10 => 'Red-eye reduction', # (this value never occurs in Green Mode) - ref 19
2593 0x20 => 'Auto', # (this value only occurs in Green Mode) - ref 19
2594 0x30 => 'Auto, Red-eye reduction', # (this value only occurs in Green Mode) - ref 19
2595 0x50 => 'Wireless (Master)',
2596 0x60 => 'Wireless (Control)',
2597 0x80 => 'Slow-sync',
2598 0x90 => 'Slow-sync, Red-eye reduction',
2599 0xa0 => 'Trailing-curtain Sync'
2600 },
2601 },
2602 16.1 => {
2603 Name => 'MeteringMode3',
2604 Condition => '$$self{Model} =~ /(K10D|GX10)\b/',
2605 Notes => 'K10D only',
2606 Mask => 0x0f,
2607 PrintConv => {
2608 0 => 'Multi-segment',
2609 BITMASK => {
2610 0 => 'Center-weighted average',
2611 1 => 'Spot',
2612 },
2613 },
2614 },
2615 # 16 Mask 0x0f - changes when changing EV steps? (K-5)
2616 17.1 => {
2617 Name => 'SRActive',
2618 Condition => '$$self{Model} =~ /(K10D|GX10)\b/',
2619 Notes => q{
2620 K10D only; SR is active only when ShakeReduction is On, DriveMode is not
2621 Remote or Self-timer, and Internal/ExternalFlashMode is not "On, Wireless"
2622 },
2623 Mask => 0x80,
2624 PrintConv => {
2625 0x00 => 'No',
2626 0x80 => 'Yes',
2627 },
2628 },
2629 17.2 => {
2630 Name => 'Rotation',
2631 Condition => '$$self{Model} =~ /(K10D|GX10)\b/',
2632 Notes => 'K10D only',
2633 Mask => 0x60,
2634 PrintConv => {
2635 0x00 => 'Horizontal (normal)',
2636 0x20 => 'Rotate 180',
2637 0x40 => 'Rotate 90 CW',
2638 0x60 => 'Rotate 270 CW',
2639 },
2640 },
2641 # Bit 0x08 is set on 3 of my 3000 shots to (All 3 were Shutter Priority
2642 # but this may not mean anything with such a small sample) - ref 19
2643 17.3 => {
2644 Name => 'ISOSetting',
2645 Condition => '$$self{Model} =~ /(K10D|GX10)\b/',
2646 Notes => 'K10D only',
2647 Mask => 0x04,
2648 PrintConv => {
2649 0x00 => 'Manual',
2650 0x04 => 'Auto',
2651 },
2652 },
2653 17.4 => {
2654 Name => 'SensitivitySteps',
2655 Condition => '$$self{Model} =~ /(K10D|GX10)\b/',
2656 Notes => 'K10D only',
2657 Mask => 0x02,
2658 PrintConv => {
2659 0x00 => '1 EV Steps',
2660 0x02 => 'As EV Steps',
2661 },
2662 },
2663 # 17 Mask 0x08 - changed when changing Auto ISO range (K-5)
2664 18 => {
2665 Name => 'TvExposureTimeSetting',
2666 Condition => '$$self{Model} =~ /(K10D|GX10)\b/',
2667 Notes => 'K10D only',
2668 ValueConv => 'exp(-Image::ExifTool::Pentax::PentaxEv($val-68)*log(2))',
2669 ValueConvInv => 'Image::ExifTool::Pentax::PentaxEvInv(-log($val)/log(2))+68',
2670 PrintConv => 'Image::ExifTool::Exif::PrintExposureTime($val)',
2671 PrintConvInv => 'Image::ExifTool::Exif::ConvertFraction($val)',
2672 },
2673 19 => {
2674 Name => 'AvApertureSetting',
2675 Condition => '$$self{Model} =~ /(K10D|GX10)\b/',
2676 Notes => 'K10D only',
2677 ValueConv => 'exp(Image::ExifTool::Pentax::PentaxEv($val-68)*log(2)/2)',
2678 ValueConvInv => 'Image::ExifTool::Pentax::PentaxEvInv(log($val)*2/log(2))+68',
2679 PrintConv => 'sprintf("%.1f",$val)',
2680 PrintConvInv => '$val',
2681 },
2682 20 => { #PH
2683 Name => 'SvISOSetting',
2684 Condition => '$$self{Model} =~ /(K10D|GX10)\b/',
2685 Notes => 'K10D only',
2686 # ISO setting for sensitivity-priority mode
2687 # (conversion may not give actual displayed values:)
2688 # 32 => 100, 35 => 125, 36 => 140, 37 => 160,
2689 # 40 => 200, 43 => 250, 44 => 280, 45 => 320,
2690 # 48 => 400, 51 => 500, 52 => 560, 53 => 640,
2691 # 56 => 800, 59 => 1000,60 => 1100,61 => 1250, 64 => 1600
2692 ValueConv => 'int(100*exp(Image::ExifTool::Pentax::PentaxEv($val-32)*log(2))+0.5)',
2693 ValueConvInv => 'Image::ExifTool::Pentax::PentaxEvInv(log($val/100)/log(2))+32',
2694 },
2695 21 => { #PH
2696 Name => 'BaseExposureCompensation',
2697 Condition => '$$self{Model} =~ /(K10D|GX10)\b/',
2698 Notes => 'K10D only; exposure compensation without auto bracketing',
2699 ValueConv => 'Image::ExifTool::Pentax::PentaxEv(64-$val)',
2700 ValueConvInv => '64-Image::ExifTool::Pentax::PentaxEvInv($val)',
2701 PrintConv => '$val ? sprintf("%+.1f", $val) : 0',
2702 PrintConvInv => 'Image::ExifTool::Exif::ConvertFraction($val)',
2703 },
2704);
2705
2706# auto-exposure information (ref PH)
2707%Image::ExifTool::Pentax::AEInfo = (
2708 %binaryDataAttrs,
2709 GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
2710 DATAMEMBER => [ 8 ],
2711 # instead of /8, should these be PentaxEV(), as in CameraSettings? - PH
2712 0 => {
2713 Name => 'AEExposureTime',
2714 Notes => 'val = 24 * 2**((32-raw)/8)',
2715 ValueConv => '24*exp(-($val-32)*log(2)/8)',
2716 ValueConvInv => '-log($val/24)*8/log(2)+32',
2717 PrintConv => 'Image::ExifTool::Exif::PrintExposureTime($val)',
2718 PrintConvInv => 'Image::ExifTool::Exif::ConvertFraction($val)',
2719 },
2720 1 => {
2721 Name => 'AEAperture',
2722 Notes => 'val = 2**((raw-68)/16)',
2723 ValueConv => 'exp(($val-68)*log(2)/16)',
2724 ValueConvInv => 'log($val)*16/log(2)+68',
2725 PrintConv => 'sprintf("%.1f",$val)',
2726 PrintConvInv => '$val',
2727 },
2728 2 => {
2729 Name => 'AE_ISO',
2730 Notes => 'val = 100 * 2**((raw-32)/8)',
2731 ValueConv => '100*exp(($val-32)*log(2)/8)',
2732 ValueConvInv => 'log($val/100)*8/log(2)+32',
2733 PrintConv => 'int($val + 0.5)',
2734 PrintConvInv => '$val',
2735 },
2736 3 => {
2737 Name => 'AEXv',
2738 Notes => 'val = (raw-64)/8',
2739 ValueConv => '($val-64)/8',
2740 ValueConvInv => '$val * 8 + 64',
2741 },
2742 4 => {
2743 Name => 'AEBXv',
2744 Format => 'int8s',
2745 Notes => 'val = raw / 8',
2746 ValueConv => '$val / 8',
2747 ValueConvInv => '$val * 8',
2748 },
2749 5 => {
2750 Name => 'AEMinExposureTime', #19
2751 Notes => 'val = 24 * 2**((32-raw)/8)',
2752 ValueConv => '24*exp(-($val-32)*log(2)/8)', #JD
2753 ValueConvInv => '-log($val/24)*8/log(2)+32',
2754 PrintConv => 'Image::ExifTool::Exif::PrintExposureTime($val)',
2755 PrintConvInv => 'Image::ExifTool::Exif::ConvertFraction($val)',
2756 },
2757 6 => {
2758 Name => 'AEProgramMode',
2759 PrintConvColumns => 2,
2760 PrintConv => {
2761 0 => 'M, P or TAv',
2762 1 => 'Av, B or X',
2763 2 => 'Tv',
2764 3 => 'Sv or Green Mode',
2765 8 => 'Hi-speed Program',
2766 11 => 'Hi-speed Program (P-Shift)', #19
2767 16 => 'DOF Program', #19
2768 19 => 'DOF Program (P-Shift)', #19
2769 24 => 'MTF Program', #19
2770 27 => 'MTF Program (P-Shift)', #19
2771 35 => 'Standard',
2772 43 => 'Portrait',
2773 51 => 'Landscape',
2774 59 => 'Macro',
2775 67 => 'Sport',
2776 75 => 'Night Scene Portrait',
2777 83 => 'No Flash',
2778 91 => 'Night Scene',
2779 99 => 'Surf & Snow',
2780 107 => 'Text',
2781 115 => 'Sunset',
2782 123 => 'Kids',
2783 131 => 'Pet',
2784 139 => 'Candlelight',
2785 147 => 'Museum',
2786 184 => 'Shallow DOF Program', # (K-5)
2787 },
2788 },
2789 7 => {
2790 Name => 'AEFlags',
2791 Unknown => 1,
2792 Writable => 0,
2793 PrintConv => { #19
2794 # (seems to be the warnings displayed in the viewfinder for several bits)
2795 BITMASK => {
2796 # 0 - seen in extreme low light conditions (e.g. Lens Cap On)
2797 # 1 - seen in 2 cases, Aperture Priority mode, Auto ISO at 100,
2798 # Shutter speed at 1/4000 and aperture opened wider causing under exposure
2799 # 2 - only (but not always) set in Shutter Speed Priority (seems to be when over/under exposed).
2800 # In one case set when auto exposure compensation changed the Tv from 1/250 to 1/80.
2801 # In another case set when external flash was in SB mode so did not fire.
2802 3 => 'AE lock',
2803 4 => 'Flash recommended?', # not 100% sure of this one
2804 # 5 - seen lots...
2805 # 6 - seen lots...
2806 7 => 'Aperture wide open', # mostly true... (Set for all my lenses except for DA* 16-50mm)
2807 },
2808 },
2809 },
2810 8 => {
2811 Name => 'AEUnknown',
2812 Notes => 'indices after this are incremented by 1 for some models',
2813 Format => 'var_int8u[$size > 20 ? 2 : 1]',
2814 Writable => 0,
2815 # (this tag can't be unknown because the Format must be evaluated
2816 # to shift the following offsets if necessary. Instead, ignore
2817 # the return value unless Unknown > 1)
2818 RawConv => '$$self{OPTIONS}{Unknown} > 1 ? $val : undef',
2819 },
2820 # Note: Offsets below shifted by 1 if record size is > 20 bytes
2821 # (implemented by the var_int8u count above)
2822 9 => { #19
2823 Name => 'AEMaxAperture',
2824 Notes => 'val = 2**((raw-68)/16)',
2825 ValueConv => 'exp(($val-68)*log(2)/16)',
2826 ValueConvInv => 'log($val)*16/log(2)+68',
2827 PrintConv => 'sprintf("%.1f",$val)',
2828 PrintConvInv => '$val',
2829 },
2830 10 => { #19
2831 Name => 'AEMaxAperture2',
2832 Notes => 'val = 2**((raw-68)/16)',
2833 ValueConv => 'exp(($val-68)*log(2)/16)',
2834 ValueConvInv => 'log($val)*16/log(2)+68',
2835 PrintConv => 'sprintf("%.1f",$val)',
2836 PrintConvInv => '$val',
2837 },
2838 11 => { #19
2839 Name => 'AEMinAperture',
2840 Notes => 'val = 2**((raw-68)/16)',
2841 ValueConv => 'exp(($val-68)*log(2)/16)',
2842 ValueConvInv => 'log($val)*16/log(2)+68',
2843 PrintConv => 'sprintf("%.0f",$val)',
2844 PrintConvInv => '$val',
2845 },
2846 12 => { #19
2847 Name => 'AEMeteringMode',
2848 PrintConv => {
2849 0 => 'Multi-segment',
2850 BITMASK => {
2851 4 => 'Center-weighted average',
2852 5 => 'Spot',
2853 },
2854 },
2855 },
2856 # 13 - related to program mode somehow - PH
2857 14 => { #19
2858 Name => 'FlashExposureCompSet',
2859 Format => 'int8s',
2860 Notes => q{
2861 reports the camera setting, unlike tag 0x004d which reports 0 in Green mode
2862 or if flash was on but did not fire. Both this tag and 0x004d report the
2863 setting even if the flash is off
2864 },
2865 ValueConv => 'Image::ExifTool::Pentax::PentaxEv($val)',
2866 ValueConvInv => 'Image::ExifTool::Pentax::PentaxEvInv($val)',
2867 PrintConv => '$val ? sprintf("%+.1f", $val) : 0',
2868 PrintConvInv => 'Image::ExifTool::Exif::ConvertFraction($val)',
2869 },
2870);
2871
2872# lens information (ref PH)
2873%Image::ExifTool::Pentax::LensInfo = (
2874 %binaryDataAttrs,
2875 GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
2876 IS_SUBDIR => [ 3 ],
2877 NOTES => 'Pentax lens information structure for models such as the *istD.',
2878 0 => {
2879 Name => 'LensType',
2880 Format => 'int8u[2]',
2881 Priority => 0,
2882 PrintConv => \%pentaxLensTypes,
2883 SeparateTable => 1,
2884 },
2885 3 => {
2886 Name => 'LensData',
2887 Format => 'undef[17]',
2888 SubDirectory => { TagTable => 'Image::ExifTool::Pentax::LensData' },
2889 },
2890);
2891
2892# lens information for newer models (ref PH)
2893%Image::ExifTool::Pentax::LensInfo2 = (
2894 %binaryDataAttrs,
2895 GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
2896 IS_SUBDIR => [ 4 ],
2897 NOTES => 'Pentax lens information structure for models such as the K10D and K20D.',
2898 0 => {
2899 Name => 'LensType',
2900 Format => 'int8u[4]',
2901 Priority => 0,
2902 ValueConv => q{
2903 my @v = split(' ',$val);
2904 $v[0] &= 0x0f;
2905 $v[1] = $v[2] * 256 + $v[3]; # (always high byte first)
2906 return "$v[0] $v[1]";
2907 },
2908 PrintConv => \%pentaxLensTypes,
2909 SeparateTable => 1,
2910 },
2911 4 => {
2912 Name => 'LensData',
2913 Format => 'undef[17]',
2914 SubDirectory => { TagTable => 'Image::ExifTool::Pentax::LensData' },
2915 },
2916);
2917
2918# lens information for 645D (ref PH)
2919%Image::ExifTool::Pentax::LensInfo3 = (
2920 %binaryDataAttrs,
2921 GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
2922 IS_SUBDIR => [ 13 ],
2923 NOTES => 'Pentax lens information structure for 645D.',
2924 1 => {
2925 Name => 'LensType',
2926 Format => 'int8u[4]',
2927 Priority => 0,
2928 ValueConv => q{
2929 my @v = split(' ',$val);
2930 $v[0] &= 0x0f;
2931 $v[1] = $v[2] * 256 + $v[3]; # (always high byte first)
2932 return "$v[0] $v[1]";
2933 },
2934 PrintConv => \%pentaxLensTypes,
2935 SeparateTable => 1,
2936 },
2937 13 => {
2938 Name => 'LensData',
2939 Format => 'undef[17]',
2940 SubDirectory => { TagTable => 'Image::ExifTool::Pentax::LensData' },
2941 },
2942);
2943
2944# lens information for K-5, K-r, etc (ref PH)
2945%Image::ExifTool::Pentax::LensInfo4 = (
2946 %binaryDataAttrs,
2947 GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
2948 IS_SUBDIR => [ 12 ],
2949 NOTES => 'Pentax lens information structure for models such as the K-5 and K-r.',
2950 1 => {
2951 Name => 'LensType',
2952 Format => 'int8u[4]',
2953 Priority => 0,
2954 ValueConv => q{
2955 my @v = split(' ',$val);
2956 $v[0] &= 0x0f;
2957 $v[1] = $v[2] * 256 + $v[3]; # (always high byte first)
2958 return "$v[0] $v[1]";
2959 },
2960 PrintConv => \%pentaxLensTypes,
2961 SeparateTable => 1,
2962 },
2963 12 => {
2964 Name => 'LensData',
2965 Format => 'undef[17]',
2966 SubDirectory => { TagTable => 'Image::ExifTool::Pentax::LensData' },
2967 },
2968);
2969
2970# lens data information, including lens codes (ref PH)
2971%Image::ExifTool::Pentax::LensData = (
2972 %binaryDataAttrs,
2973 GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
2974 NOTES => q{
2975 Pentax lens data information. Some of these tags require interesting binary
2976 gymnastics to decode them into useful values.
2977 },
2978 # this byte comes from the lens electrical contacts
2979 # (see http://kmp.bdimitrov.de/technology/K-mount/Ka.html)
2980 0.1 => { #JD
2981 Name => 'AutoAperture',
2982 Mask => 0x01,
2983 PrintConv => {
2984 0 => 'On',
2985 1 => 'Off',
2986 },
2987 },
2988 0.2 => { #JD
2989 Name => 'MinAperture',
2990 Mask => 0x06,
2991 PrintConv => {
2992 0x00 => 22,
2993 0x02 => 32,
2994 0x04 => 45,
2995 0x06 => 16,
2996 },
2997 },
2998 0.3 => { #JD
2999 Name => 'LensFStops',
3000 Mask => 0x70,
3001 ValueConv => '5 + (($val >> 4) ^ 0x07) / 2',
3002 ValueConvInv => '((($val - 5) * 2) ^ 0x07) << 4',
3003 },
3004 # 1-16 look like Lens Codes LC0-LC15, ref patent 5617173 and 5999753 [+notes by PH]
3005 1 => { # LC0 = lens kind + version data
3006 Name => 'LensKind',
3007 %lensCode,
3008 },
3009 2 => { # LC1 = lens data (changes with AF setting)
3010 Name => 'LC1',
3011 %lensCode,
3012 },
3013 3 => { # LC2 = distance data
3014 Name => 'LC2',
3015 %lensCode,
3016 # FocusRange decoding needs more testing with various lenses - PH
3017 TestName => 'FocusRange',
3018 TestPrintConv => q{
3019 my @v;
3020 my $lsb = $val & 0x07;
3021 my $msb = $val >> 3;
3022 my $ls2 = $lsb ^ 0x07;
3023 $ls2 ^= 0x01 if $ls2 & 0x02;
3024 $ls2 ^= 0x03 if $ls2 & 0x04;
3025 foreach ($ls2, $ls2+1) {
3026 push(@v,'inf'), next if $_ > 7;
3027 push @v, sprintf("%.2f m", 2 ** ($msb / 4) * 0.18 * ($_ + 4) / 16);
3028 }
3029 return join ' - ', @v;
3030 },
3031 },
3032 4 => { # LC3 = K-value data (AF pulses to displace image by unit length)
3033 Name => 'LC3',
3034 %lensCode,
3035 },
3036 5 => { # LC4 = abberation correction, near distance data
3037 Name => 'LC4',
3038 %lensCode,
3039 },
3040 6 => { # LC5 = light color abberation correction data
3041 Name => 'LC5',
3042 %lensCode,
3043 },
3044 7 => { # LC6 = open abberation data
3045 Name => 'LC6',
3046 %lensCode,
3047 },
3048 8 => { # LC7 = AF minimum actuation condition
3049 Name => 'LC7',
3050 %lensCode,
3051 },
3052 9 => { # LC8 = focal length data
3053 Name => 'FocalLength',
3054 Priority => 0,
3055 ValueConv => '10*($val>>2) * 4**(($val&0x03)-2)', #JD
3056 ValueConvInv => q{
3057 my $range = int(log($val/10)/(2*log(2)));
3058 warn("Value out of range") and return undef if $range < 0 or $range > 3;
3059 return $range + (int($val/(10*4**($range-2))+0.5) << 2);
3060 },
3061 PrintConv => 'sprintf("%.1f mm", $val)',
3062 PrintConvInv => '$val=~s/\s*mm//; $val',
3063 },
3064 # the following aperture values change with focal length
3065 10 => { # LC9 = nominal AVmin/AVmax data (open/closed aperture values)
3066 Name => 'NominalMaxAperture',
3067 Mask => 0xf0,
3068 ValueConv => '2**(($val>>4)/4)', #JD
3069 ValueConvInv => '4*log($val)/log(2) << 4',
3070 PrintConv => 'sprintf("%.1f", $val)',
3071 PrintConvInv => '$val',
3072 },
3073 10.1 => { # LC9 = nominal AVmin/AVmax data (open/closed aperture values)
3074 Name => 'NominalMinAperture',
3075 Mask => 0x0f,
3076 ValueConv => '2**(($val+10)/4)', #JD
3077 ValueConvInv => '4*log($val)/log(2) - 10',
3078 PrintConv => 'sprintf("%.0f", $val)',
3079 PrintConvInv => '$val',
3080 },
3081 11 => { # LC10 = mv'/nv' data (full-aperture metering error compensation/marginal lumination compensation)
3082 Name => 'LC10',
3083 %lensCode,
3084 },
3085 12 => { # LC11 = AVC 1/EXP data
3086 Name => 'LC11',
3087 %lensCode,
3088 },
3089 13 => { # LC12 = mv1 AVminsif data
3090 Name => 'LC12',
3091 %lensCode,
3092 },
3093 14.1 => { # LC13 = AVmin (open aperture value) [MaxAperture=(2**((AVmin-1)/32))]
3094 Name => 'MaxAperture',
3095 Notes => 'effective wide open aperture for current focal length',
3096 Mask => 0x7f, # (not sure what the high bit indicates)
3097 # (a value of 1 seems to indicate 'n/a')
3098 RawConv => '$val > 1 ? $val : undef',
3099 ValueConv => '2**(($val-1)/32)',
3100 ValueConvInv => '32*log($val)/log(2) + 1',
3101 PrintConv => 'sprintf("%.1f", $val)',
3102 PrintConvInv => '$val',
3103 },
3104 15 => { # LC14 = UNT_12 UNT_6 data
3105 Name => 'LC14',
3106 %lensCode,
3107 },
3108 16 => { # LC15 = incorporated flash suited END data
3109 Name => 'LC15',
3110 %lensCode,
3111 },
3112);
3113
3114# flash information (ref PH)
3115%Image::ExifTool::Pentax::FlashInfo = (
3116 %binaryDataAttrs,
3117 GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
3118 NOTES => 'Flash information tags for the K10D, K20D and K200D.',
3119 0 => {
3120 Name => 'FlashStatus',
3121 PrintHex => 1,
3122 PrintConv => { #19
3123 0x00 => 'Off',
3124 0x01 => 'Off (1)', #PH (K-5)
3125 0x02 => 'External, Did not fire', # 0010
3126 0x06 => 'External, Fired', # 0110
3127 0x08 => 'Internal, Did not fire (0x08)',
3128 0x09 => 'Internal, Did not fire', # 1001
3129 0x0d => 'Internal, Fired', # 1101
3130 },
3131 },
3132 1 => {
3133 Name => 'InternalFlashMode',
3134 PrintHex => 1,
3135 PrintConv => {
3136 0x00 => 'n/a - Off-Auto-Aperture', #19
3137 0x86 => 'Fired, Wireless (Control)', #19
3138 0x95 => 'Fired, Wireless (Master)', #19
3139 0xc0 => 'Fired', # K10D
3140 0xc1 => 'Fired, Red-eye reduction', # *istDS2, K10D
3141 0xc2 => 'Fired, Auto', # K100D, K110D
3142 0xc3 => 'Fired, Auto, Red-eye reduction', #PH
3143 0xc6 => 'Fired, Wireless (Control), Fired normally not as control', #19 (Remote 3s)
3144 0xc8 => 'Fired, Slow-sync', # K10D
3145 0xc9 => 'Fired, Slow-sync, Red-eye reduction', # K10D
3146 0xca => 'Fired, Trailing-curtain Sync', # K10D
3147 0xf0 => 'Did not fire, Normal', #19
3148 0xf1 => 'Did not fire, Red-eye reduction', #19
3149 0xf2 => 'Did not fire, Auto', #19
3150 0xf3 => 'Did not fire, Auto, Red-eye reduction', #19
3151 0xf4 => 'Did not fire, (Unknown 0xf4)', #19
3152 0xf5 => 'Did not fire, Wireless (Master)', #19
3153 0xf6 => 'Did not fire, Wireless (Control)', #19
3154 0xf8 => 'Did not fire, Slow-sync', #19
3155 0xf9 => 'Did not fire, Slow-sync, Red-eye reduction', #19
3156 0xfa => 'Did not fire, Trailing-curtain Sync', #19
3157 },
3158 },
3159 2 => {
3160 Name => 'ExternalFlashMode',
3161 PrintHex => 1,
3162 PrintConv => { #19
3163 0x00 => 'n/a - Off-Auto-Aperture',
3164 0x3f => 'Off',
3165 0x40 => 'On, Auto',
3166 0xbf => 'On, Flash Problem', #JD
3167 0xc0 => 'On, Manual',
3168 0xc4 => 'On, P-TTL Auto',
3169 0xc5 => 'On, Contrast-control Sync', #JD
3170 0xc6 => 'On, High-speed Sync',
3171 0xcc => 'On, Wireless',
3172 0xcd => 'On, Wireless, High-speed Sync',
3173 0xf0 => 'Not Connected', #PH (K-5)
3174 },
3175 },
3176 3 => {
3177 Name => 'InternalFlashStrength',
3178 Notes => 'saved from the most recent flash picture, on a scale of about 0 to 100',
3179 },
3180 4 => 'TTL_DA_AUp',
3181 5 => 'TTL_DA_ADown',
3182 6 => 'TTL_DA_BUp',
3183 7 => 'TTL_DA_BDown',
3184 24.1 => { #19/17
3185 Name => 'ExternalFlashGuideNumber',
3186 Mask => 0x1f,
3187 Notes => 'val = 2**(raw/16 + 4), with a few exceptions',
3188 ValueConv => q{
3189 return 0 unless $val;
3190 $val = -3 if $val == 29; # -3 is stored as 0x1d
3191 return 2**($val/16 + 4);
3192 },
3193 ValueConvInv => q{
3194 return 0 unless $val;
3195 my $raw = int((log($val)/log(2)-4)*16+0.5);
3196 $raw = 29 if $raw < 0; # guide number of 14 gives -3 which is stored as 0x1d
3197 $raw = 31 if $raw > 31; # maximum value is 0x1f
3198 return $raw;
3199 },
3200 PrintConv => '$val ? int($val + 0.5) : "n/a"',
3201 PrintConvInv => '$val=~/^n/ ? 0 : $val',
3202 # observed values for various flash focal lengths/guide numbers:
3203 # AF-540FGZ (ref 19) AF-360FGZ (ref 17)
3204 # 6 => 20mm/21 29 => 20mm/14 (wide angle panel used)
3205 # 16 => 24mm/32 6 => 24mm/21
3206 # 18 => 28mm/35 7 => 28mm/22
3207 # 21 => 35mm/39 10 => 35mm/25
3208 # 24 => 50mm/45 14 => 50mm/30
3209 # 26 => 70mm/50 17 => 70mm/33
3210 # 28 => 85mm/54 19 => 85mm/36
3211 # (I have also seen a value of 31 when both flashes are used together
3212 # in a wired configuration, but I don't know exactly what this means - PH)
3213 },
3214 # 24 - have seen bit 0x80 set when 2 external wired flashes are used - PH
3215 # 24 - have seen bit 0x40 set when wireless high speed sync is used - ref 19
3216 25 => { #19
3217 Name => 'ExternalFlashExposureComp',
3218 PrintConv => {
3219 0 => 'n/a', # Off or Auto Modes
3220 144 => 'n/a (Manual Mode)', # Manual Flash Output
3221 164 => '-3.0',
3222 167 => '-2.5',
3223 168 => '-2.0',
3224 171 => '-1.5',
3225 172 => '-1.0',
3226 175 => '-0.5',
3227 176 => '0.0',
3228 179 => '0.5',
3229 180 => '1.0',
3230 },
3231 },
3232 26 => { #17
3233 Name => 'ExternalFlashBounce',
3234 Notes => 'saved from the most recent external flash picture', #19
3235 PrintConv => {
3236 0 => 'n/a',
3237 16 => 'Direct',
3238 48 => 'Bounce',
3239 },
3240 },
3241 # ? => 'ExternalFlashAOutput',
3242 # ? => 'ExternalFlashBOutput',
3243);
3244
3245%Image::ExifTool::Pentax::FlashInfoUnknown = (
3246 %binaryDataAttrs,
3247 GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
3248 # 4 - changes with FEC for K-5 - PH
3249);
3250
3251# camera manufacture information (ref PH)
3252%Image::ExifTool::Pentax::CameraInfo = (
3253 %binaryDataAttrs,
3254 GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
3255 FORMAT => 'int32u',
3256 0 => {
3257 Name => 'PentaxModelID',
3258 Priority => 0, # (Optio SVi uses incorrect Optio SV ID here)
3259 SeparateTable => 1,
3260 PrintHex => 1,
3261 PrintConv => \%pentaxModelID,
3262 },
3263 1 => {
3264 Name => 'ManufactureDate',
3265 Groups => { 2 => 'Time' },
3266 Notes => q{
3267 this value, and the values of the tags below, may change if the camera is
3268 serviced
3269 },
3270 ValueConv => q{
3271 $val =~ /^(\d{4})(\d{2})(\d{2})$/ and return "$1:$2:$3";
3272 # Optio A10 and A20 leave "200" off the year
3273 $val =~ /^(\d)(\d{2})(\d{2})$/ and return "200$1:$2:$3";
3274 return "Unknown ($val)";
3275 },
3276 ValueConvInv => '$val=~tr/0-9//dc; $val',
3277 },
3278 2 => {
3279 #(see http://www.pentaxforums.com/forums/pentax-dslr-discussion/25711-k10d-update-model-revision-8-1-yes-no-8.html)
3280 Name => 'ProductionCode', #(previously ModelRevision)
3281 Format => 'int32u[2]',
3282 Note => 'values of 8.x indicate that the camera has been serviced',
3283 ValueConv => '$val=~tr/ /./; $val',
3284 ValueConvInv => '$val=~tr/./ /; $val',
3285 PrintConv => '$val=~/^8\./ ? "$val (camera has been serviced)" : $val',
3286 PrintConvInv => '$val=~s/\s+.*//s; $val',
3287 },
3288 4 => 'InternalSerialNumber',
3289);
3290
3291# battery information (ref PH)
3292%Image::ExifTool::Pentax::BatteryInfo = (
3293 %binaryDataAttrs,
3294 GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
3295# size of data:
3296# 4 (K-m,K2000=4xAA), 6 (*istD,K10D,K100D,K110D=2xCR-V3/4xAA),
3297# 7 (K20D=D-LI50, K200D=4xAA), 8 (645D=D-LI90), 10 (K-r pre-production?),
3298# 14 (K-7=D-LI90, K-r=D-LI109/4xAA, K-x=4xAA), 26 (K-5=D-LI90)
3299# battery grips available for:
3300# BG1 (*istD), BG2 (K10D/K20D), BG3 (K200D), BG4 (K-7,K-5)
3301# no grip available: K-x
3302 0.1 => { #19
3303 Name => 'PowerSource',
3304 Mask => 0x0f,
3305 # have seen the upper bit set (value of 0x82) for the
3306 # *istDS and K100D, but I'm not sure what this means - PH
3307 # I've also seen: 0x42 (K2000), 0xf2 (K-7,K-r,K-5), 0x12,0x22 (K-x) - PH
3308 PrintConv => {
3309 2 => 'Body Battery',
3310 3 => 'Grip Battery',
3311 4 => 'External Power Supply', #PH
3312 },
3313 },
3314 1.1 => [
3315 {
3316 Name => 'BodyBatteryState',
3317 Condition => '$$self{Model} =~ /(\*ist|K100D|K200D|K10D|GX10|K20D|GX20)\b/',
3318 Notes => '*istD, K100D, K200D, K10D and K20D',
3319 Mask => 0xf0,
3320 PrintConv => { #19
3321 0x10 => 'Empty or Missing',
3322 0x20 => 'Almost Empty',
3323 0x30 => 'Running Low',
3324 0x40 => 'Full',
3325 },
3326 },{
3327 Name => 'BodyBatteryState',
3328 Condition => '$$self{Model} =~ /(K-5|K-7|K-r|K-x|645D)\b/',
3329 Notes => 'K-5, K-7, K-r, K-x and 645D',
3330 Mask => 0xf0,
3331 PrintConv => {
3332 0x10 => 'Empty or Missing',
3333 0x20 => 'Almost Empty',
3334 0x30 => 'Running Low',
3335 0x40 => 'Close to Full',
3336 0x50 => 'Full',
3337 },
3338 },{
3339 Name => 'BodyBatteryState',
3340 Notes => 'decoding unknown for other models',
3341 Mask => 0xf0,
3342 ValueConv => '$val >> 4',
3343 ValueConvInv => '$val << 4',
3344 },
3345 ],
3346 1.2 => [
3347 {
3348 Name => 'GripBatteryState',
3349 Condition => '$$self{Model} =~ /(K10D|GX10|K20D|GX20)\b/',
3350 Notes => 'K10D and K20D',
3351 Mask => 0x0f,
3352 PrintConv => { #19
3353 0x01 => 'Empty or Missing',
3354 0x02 => 'Almost Empty',
3355 0x03 => 'Running Low',
3356 0x04 => 'Full',
3357 },
3358 },{
3359 Name => 'GripBatteryState',
3360 Notes => 'decoding unknown for other models',
3361 Unknown => 1, # (doesn't appear to be valid for the K-5)
3362 Mask => 0x0f,
3363 },
3364 ],
3365 # internal and grip battery voltage Analogue to Digital measurements,
3366 # open circuit and under load
3367 2 => [
3368 {
3369 Name => 'BodyBatteryADNoLoad',
3370 Description => 'Body Battery A/D No Load',
3371 Condition => '$$self{Model} =~ /(K10D|GX10|K20D|GX20)\b/',
3372 Notes => 'roughly calibrated for K10D with a new Pentax battery',
3373 # rough linear calibration drops quickly below 30% - PH
3374 # DVM readings: 8.18V=186, 8.42-8.40V=192 (full), 6.86V=155 (empty)
3375 PrintConv => 'sprintf("%d (%.1fV, %d%%)",$val,$val*8.18/186,($val-155)*100/35)',
3376 PrintConvInv => '$val=~s/ .*//; $val',
3377 },
3378 {
3379 Name => 'BodyBatteryADNoLoad',
3380 Description => 'Body Battery A/D No Load',
3381 Condition => '$$self{Model} =~ /(\*ist|K100D|K200D)\b/',
3382 },
3383 {
3384 Name => 'BodyBatteryVoltage1', # (static?)
3385 Condition => '$$self{Model} =~ /(K-5|K-7|K-r|K-x|645D)\b/',
3386 Format => 'int16u',
3387 ValueConv => '$val / 100',
3388 ValueConvInv => '$val * 100',
3389 PrintConv => 'sprintf("%.2f V", $val)',
3390 PrintConvInv => '$val =~ s/\s*V$//',
3391 # For my K-5: Min (0%) Max (100%) Meas
3392 # BodyBatteryVoltage1 6.24 V 7.75 V 7.66 V
3393 # BodyBatteryVoltage2 5.98 V 7.43 V 7.34 V
3394 # BodyBatteryVoltage3 6.41 V 7.93 V 7.84 V
3395 # BodyBatteryVoltage4 6.10 V 7.55 V 7.45 V
3396 # "Meas" open-circuit voltages with DVM: AB=0V, AC=+8.33V, BC=+8.22V
3397 # (terminal "C" is closest to edge of battery)
3398 },
3399 ],
3400 3 => [
3401 {
3402 Name => 'BodyBatteryADLoad',
3403 Description => 'Body Battery A/D Load',
3404 Condition => '$$self{Model} =~ /(K10D|GX10|K20D|GX20)\b/',
3405 Notes => 'roughly calibrated for K10D with a new Pentax battery',
3406 # [have seen 187] - PH
3407 PrintConv => 'sprintf("%d (%.1fV, %d%%)",$val,$val*8.18/186,($val-152)*100/34)',
3408 PrintConvInv => '$val=~s/ .*//; $val',
3409 },
3410 {
3411 Name => 'BodyBatteryADLoad',
3412 Description => 'Body Battery A/D Load',
3413 Condition => '$$self{Model} =~ /(\*ist|K100D|K200D)\b/',
3414 },
3415 ],
3416 4 => [
3417 {
3418 Name => 'GripBatteryADNoLoad',
3419 Description => 'Grip Battery A/D No Load',
3420 Condition => '$$self{Model} =~ /(\*ist|K10D|GX10|K20D|GX20)\b/',
3421 },
3422 {
3423 Name => 'BodyBatteryVoltage2', # (less than BodyBatteryVoltage1 -- under load?)
3424 Condition => '$$self{Model} =~ /(K-5|K-7|K-r|K-x|645D)\b/',
3425 Format => 'int16u',
3426 ValueConv => '$val / 100',
3427 ValueConvInv => '$val * 100',
3428 PrintConv => 'sprintf("%.2f V", $val)',
3429 PrintConvInv => '$val =~ s/\s*V$//',
3430 },
3431 ],
3432 5 => {
3433 Name => 'GripBatteryADLoad',
3434 Condition => '$$self{Model} =~ /(\*ist|K10D|GX10|K20D|GX20)\b/',
3435 Description => 'Grip Battery A/D Load',
3436 },
3437 6 => {
3438 Name => 'BodyBatteryVoltage3', # (greater than BodyBatteryVoltage1)
3439 Condition => '$$self{Model} =~ /(K-5|K-r|645D)\b/',
3440 Format => 'int16u',
3441 Notes => 'K-5, K-r and 645D only',
3442 ValueConv => '$val / 100',
3443 ValueConvInv => '$val * 100',
3444 PrintConv => 'sprintf("%.2f V", $val)',
3445 PrintConvInv => '$val =~ s/\s*V$//',
3446 },
3447 8 => {
3448 Name => 'BodyBatteryVoltage4', # (between BodyBatteryVoltage1 and BodyBatteryVoltage2)
3449 Condition => '$$self{Model} =~ /(K-5|K-r)\b/',
3450 Format => 'int16u',
3451 Notes => 'K-5 and K-r only',
3452 ValueConv => '$val / 100',
3453 ValueConvInv => '$val * 100',
3454 PrintConv => 'sprintf("%.2f V", $val)',
3455 PrintConvInv => '$val =~ s/\s*V$//',
3456 },
3457);
3458
3459# auto focus information
3460%Image::ExifTool::Pentax::AFInfo = (
3461 %binaryDataAttrs,
3462 GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
3463 # AF Info tag names in K10D debugging output - PH:
3464 # SelectArea, InFocusArea, Predictor, Defocus, IntegTime2msStep,
3465 # CalFlag, ContrastFlag, PrecalFlag, SelectSensor
3466 0x00 => { #PH
3467 Name => 'AFPointsUnknown1',
3468 Unknown => 1,
3469 Format => 'int16u',
3470 ValueConv => '$self->Options("Unknown") ? $val : $val & 0x7ff',
3471 ValueConvInv => '$val',
3472 PrintConvColumns => 2,
3473 PrintConv => {
3474 0x07ff => 'All',
3475 0x0777 => 'Central 9 points',
3476 BITMASK => {
3477 0 => 'Upper-left',
3478 1 => 'Top',
3479 2 => 'Upper-right',
3480 3 => 'Left',
3481 4 => 'Mid-left',
3482 5 => 'Center',
3483 6 => 'Mid-right',
3484 7 => 'Right',
3485 8 => 'Lower-left',
3486 9 => 'Bottom',
3487 10 => 'Lower-right',
3488 # (bits 12-15 are flags of some sort)
3489 },
3490 },
3491 },
3492 0x02 => { #PH
3493 Name => 'AFPointsUnknown2',
3494 Unknown => 1,
3495 Format => 'int16u',
3496 ValueConv => '$self->Options("Unknown") ? $val : $val & 0x7ff',
3497 ValueConvInv => '$val',
3498 PrintConvColumns => 2,
3499 PrintConv => {
3500 0 => 'Auto',
3501 BITMASK => {
3502 0 => 'Upper-left',
3503 1 => 'Top',
3504 2 => 'Upper-right',
3505 3 => 'Left',
3506 4 => 'Mid-left',
3507 5 => 'Center',
3508 6 => 'Mid-right',
3509 7 => 'Right',
3510 8 => 'Lower-left',
3511 9 => 'Bottom',
3512 10 => 'Lower-right',
3513 # (bits 12-15 are flags of some sort)
3514 # bit 15 is set for center focus point only if it is vertical
3515 },
3516 },
3517 },
3518 0x04 => { #PH (educated guess - predicted amount to drive lens)
3519 Name => 'AFPredictor',
3520 Format => 'int16s',
3521 },
3522 0x06 => 'AFDefocus', #PH (educated guess - calculated distance from focused)
3523 0x07 => { #PH
3524 # effective exposure time for AF sensors in 2 ms increments
3525 Name => 'AFIntegrationTime',
3526 Notes => 'times less than 2 ms give a value of 0',
3527 ValueConv => '$val * 2',
3528 ValueConvInv => 'int($val / 2)', # (don't round up)
3529 PrintConv => '"$val ms"',
3530 PrintConvInv => '$val=~tr/0-9//dc; $val',
3531 },
3532 # 0x0a - values: 00,05,0d,15,86,8e,a6,ae
3533 0x0b => { #JD
3534 Name => 'AFPointsInFocus',
3535 Notes => q{
3536 may report two points in focus even though a single AFPoint has been
3537 selected, in which case the selected AFPoint is the first reported
3538 },
3539 PrintConvColumns => 2,
3540 PrintConv => {
3541 0 => 'None',
3542 1 => 'Lower-left, Bottom',
3543 2 => 'Bottom',
3544 3 => 'Lower-right, Bottom',
3545 4 => 'Mid-left, Center',
3546 5 => 'Center (horizontal)', #PH
3547 6 => 'Mid-right, Center',
3548 7 => 'Upper-left, Top',
3549 8 => 'Top',
3550 9 => 'Upper-right, Top',
3551 10 => 'Right',
3552 11 => 'Lower-left, Mid-left',
3553 12 => 'Upper-left, Mid-left',
3554 13 => 'Bottom, Center',
3555 14 => 'Top, Center',
3556 15 => 'Lower-right, Mid-right',
3557 16 => 'Upper-right, Mid-right',
3558 17 => 'Left',
3559 18 => 'Mid-left',
3560 19 => 'Center (vertical)', #PH
3561 20 => 'Mid-right',
3562 },
3563 },
3564);
3565
3566# color information - PH
3567%Image::ExifTool::Pentax::ColorInfo = (
3568 %binaryDataAttrs,
3569 GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
3570 FORMAT => 'int8s',
3571 16 => {
3572 Name => 'WBShiftAB',
3573 Notes => 'positive is a shift toward blue',
3574 },
3575 17 => {
3576 Name => 'WBShiftMG',
3577 Notes => 'positive is a shift toward green',
3578 },
3579);
3580
3581# EV step size information - ref 19
3582%Image::ExifTool::Pentax::EVStepInfo = (
3583 %binaryDataAttrs,
3584 GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
3585 0 => {
3586 Name => 'EVSteps',
3587 PrintConv => {
3588 0 => '1/2 EV Steps',
3589 1 => '1/3 EV Steps',
3590 },
3591 },
3592 1 => {
3593 Name => 'SensitivitySteps',
3594 PrintConv => {
3595 0 => '1 EV Steps',
3596 1 => 'As EV Steps',
3597 },
3598 },
3599);
3600
3601# shot information? - ref PH (K-5)
3602%Image::ExifTool::Pentax::ShotInfo = (
3603 %binaryDataAttrs,
3604 GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
3605 # 0: 0xf2/0xf3 (HDR), 0xf0 (otherwise)
3606 1 => { # (presumably this is from an orientation sensor)
3607 Name => 'CameraOrientation',
3608 Condition => '$$self{Model} =~ /K-[^m]/',
3609 Notes => 'K-5, K-7, K-r and K-x',
3610 PrintHex => 1,
3611 PrintConv => {
3612 0x10 => 'Horizontal (normal)',
3613 0x20 => 'Rotate 180',
3614 0x30 => 'Rotate 90 CW',
3615 0x40 => 'Rotate 270 CW',
3616 0x50 => 'Upwards', # (to the sky)
3617 0x60 => 'Downwards', # (to the ground)
3618 },
3619 },
3620 # 2: 0xd3 (live view), 0xdb (HDR), 0x7b (otherwise)
3621 # 3: 0xff
3622 # 4: 0x64, 0x6a, 0x6f, 0xa4, 0xaa, 0xab, 0xbf
3623 # 5: 0xfe
3624 # 6: 0x0e
3625 # 7: 0x02 (live view), 0x06 (otherwise)
3626 # 8-10: 0x00
3627);
3628
3629# face detect positions - ref PH (Optio RZ10)
3630%Image::ExifTool::Pentax::FacePos = (
3631 %binaryDataAttrs,
3632 GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
3633 FORMAT => 'int16u',
3634 0 => {
3635 Name => 'Face1Position',
3636 Format => 'int16u[2]',
3637 RawConv => '$$self{FacesDetected} < 1 ? undef : $val',
3638 Notes => 'X/Y coordinates of face center in full-sized image',
3639 },
3640 2 => {
3641 Name => 'Face2Position',
3642 Format => 'int16u[2]',
3643 RawConv => '$$self{FacesDetected} < 2 ? undef : $val',
3644 },
3645 4 => {
3646 Name => 'Face3Position',
3647 Format => 'int16u[2]',
3648 RawConv => '$$self{FacesDetected} < 3 ? undef : $val',
3649 },
3650 6 => {
3651 Name => 'Face4Position',
3652 Format => 'int16u[2]',
3653 RawConv => '$$self{FacesDetected} < 4 ? undef : $val',
3654 },
3655 8 => {
3656 Name => 'Face5Position',
3657 Format => 'int16u[2]',
3658 RawConv => '$$self{FacesDetected} < 5 ? undef : $val',
3659 },
3660 10 => {
3661 Name => 'Face6Position',
3662 Format => 'int16u[2]',
3663 RawConv => '$$self{FacesDetected} < 6 ? undef : $val',
3664 },
3665 12 => {
3666 Name => 'Face7Position',
3667 Format => 'int16u[2]',
3668 RawConv => '$$self{FacesDetected} < 7 ? undef : $val',
3669 },
3670 14 => {
3671 Name => 'Face8Position',
3672 Format => 'int16u[2]',
3673 RawConv => '$$self{FacesDetected} < 8 ? undef : $val',
3674 },
3675 16 => {
3676 Name => 'Face9Position',
3677 Format => 'int16u[2]',
3678 RawConv => '$$self{FacesDetected} < 9 ? undef : $val',
3679 },
3680 18 => {
3681 Name => 'Face10Position',
3682 Format => 'int16u[2]',
3683 RawConv => '$$self{FacesDetected} < 10 ? undef : $val',
3684 },
3685 20 => {
3686 Name => 'Face11Position',
3687 Format => 'int16u[2]',
3688 RawConv => '$$self{FacesDetected} < 11 ? undef : $val',
3689 },
3690 22 => {
3691 Name => 'Face12Position',
3692 Format => 'int16u[2]',
3693 RawConv => '$$self{FacesDetected} < 12 ? undef : $val',
3694 },
3695 24 => {
3696 Name => 'Face13Position',
3697 Format => 'int16u[2]',
3698 RawConv => '$$self{FacesDetected} < 13 ? undef : $val',
3699 },
3700 26 => {
3701 Name => 'Face14Position',
3702 Format => 'int16u[2]',
3703 RawConv => '$$self{FacesDetected} < 14 ? undef : $val',
3704 },
3705 28 => {
3706 Name => 'Face15Position',
3707 Format => 'int16u[2]',
3708 RawConv => '$$self{FacesDetected} < 15 ? undef : $val',
3709 },
3710 30 => {
3711 Name => 'Face16Position',
3712 Format => 'int16u[2]',
3713 RawConv => '$$self{FacesDetected} < 16 ? undef : $val',
3714 },
3715 32 => {
3716 Name => 'Face17Position',
3717 Format => 'int16u[2]',
3718 RawConv => '$$self{FacesDetected} < 17 ? undef : $val',
3719 },
3720 34 => {
3721 Name => 'Face18Position',
3722 Format => 'int16u[2]',
3723 RawConv => '$$self{FacesDetected} < 18 ? undef : $val',
3724 },
3725 36 => {
3726 Name => 'Face19Position',
3727 Format => 'int16u[2]',
3728 RawConv => '$$self{FacesDetected} < 19 ? undef : $val',
3729 },
3730 38 => {
3731 Name => 'Face20Position',
3732 Format => 'int16u[2]',
3733 RawConv => '$$self{FacesDetected} < 20 ? undef : $val',
3734 },
3735 40 => {
3736 Name => 'Face21Position',
3737 Format => 'int16u[2]',
3738 RawConv => '$$self{FacesDetected} < 21 ? undef : $val',
3739 },
3740 42 => {
3741 Name => 'Face22Position',
3742 Format => 'int16u[2]',
3743 RawConv => '$$self{FacesDetected} < 22 ? undef : $val',
3744 },
3745 44 => {
3746 Name => 'Face23Position',
3747 Format => 'int16u[2]',
3748 RawConv => '$$self{FacesDetected} < 23 ? undef : $val',
3749 },
3750 46 => {
3751 Name => 'Face24Position',
3752 Format => 'int16u[2]',
3753 RawConv => '$$self{FacesDetected} < 24 ? undef : $val',
3754 },
3755 48 => {
3756 Name => 'Face25Position',
3757 Format => 'int16u[2]',
3758 RawConv => '$$self{FacesDetected} < 25 ? undef : $val',
3759 },
3760 50 => {
3761 Name => 'Face26Position',
3762 Format => 'int16u[2]',
3763 RawConv => '$$self{FacesDetected} < 26 ? undef : $val',
3764 },
3765 52 => {
3766 Name => 'Face27Position',
3767 Format => 'int16u[2]',
3768 RawConv => '$$self{FacesDetected} < 27 ? undef : $val',
3769 },
3770 54 => {
3771 Name => 'Face28Position',
3772 Format => 'int16u[2]',
3773 RawConv => '$$self{FacesDetected} < 28 ? undef : $val',
3774 },
3775 56 => {
3776 Name => 'Face29Position',
3777 Format => 'int16u[2]',
3778 RawConv => '$$self{FacesDetected} < 29 ? undef : $val',
3779 },
3780 58 => {
3781 Name => 'Face30Position',
3782 Format => 'int16u[2]',
3783 RawConv => '$$self{FacesDetected} < 30 ? undef : $val',
3784 },
3785 60 => {
3786 Name => 'Face31Position',
3787 Format => 'int16u[2]',
3788 RawConv => '$$self{FacesDetected} < 31 ? undef : $val',
3789 },
3790 62 => {
3791 Name => 'Face32Position',
3792 Format => 'int16u[2]',
3793 RawConv => '$$self{FacesDetected} < 32 ? undef : $val',
3794 },
3795);
3796
3797# face detect sizes - ref PH (Optio RZ10)
3798%Image::ExifTool::Pentax::FaceSize = (
3799 %binaryDataAttrs,
3800 GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
3801 FORMAT => 'int16u',
3802 0 => {
3803 Name => 'Face1Size',
3804 Format => 'int16u[2]',
3805 RawConv => '$$self{FacesDetected} < 1 ? undef : $val',
3806 },
3807 2 => {
3808 Name => 'Face2Size',
3809 Format => 'int16u[2]',
3810 RawConv => '$$self{FacesDetected} < 2 ? undef : $val',
3811 },
3812 4 => {
3813 Name => 'Face3Size',
3814 Format => 'int16u[2]',
3815 RawConv => '$$self{FacesDetected} < 3 ? undef : $val',
3816 },
3817 6 => {
3818 Name => 'Face4Size',
3819 Format => 'int16u[2]',
3820 RawConv => '$$self{FacesDetected} < 4 ? undef : $val',
3821 },
3822 8 => {
3823 Name => 'Face5Size',
3824 Format => 'int16u[2]',
3825 RawConv => '$$self{FacesDetected} < 5 ? undef : $val',
3826 },
3827 10 => {
3828 Name => 'Face6Size',
3829 Format => 'int16u[2]',
3830 RawConv => '$$self{FacesDetected} < 6 ? undef : $val',
3831 },
3832 12 => {
3833 Name => 'Face7Size',
3834 Format => 'int16u[2]',
3835 RawConv => '$$self{FacesDetected} < 7 ? undef : $val',
3836 },
3837 14 => {
3838 Name => 'Face8Size',
3839 Format => 'int16u[2]',
3840 RawConv => '$$self{FacesDetected} < 8 ? undef : $val',
3841 },
3842 16 => {
3843 Name => 'Face9Size',
3844 Format => 'int16u[2]',
3845 RawConv => '$$self{FacesDetected} < 9 ? undef : $val',
3846 },
3847 18 => {
3848 Name => 'Face10Size',
3849 Format => 'int16u[2]',
3850 RawConv => '$$self{FacesDetected} < 10 ? undef : $val',
3851 },
3852 20 => {
3853 Name => 'Face11Size',
3854 Format => 'int16u[2]',
3855 RawConv => '$$self{FacesDetected} < 11 ? undef : $val',
3856 },
3857 22 => {
3858 Name => 'Face12Size',
3859 Format => 'int16u[2]',
3860 RawConv => '$$self{FacesDetected} < 12 ? undef : $val',
3861 },
3862 24 => {
3863 Name => 'Face13Size',
3864 Format => 'int16u[2]',
3865 RawConv => '$$self{FacesDetected} < 13 ? undef : $val',
3866 },
3867 26 => {
3868 Name => 'Face14Size',
3869 Format => 'int16u[2]',
3870 RawConv => '$$self{FacesDetected} < 14 ? undef : $val',
3871 },
3872 28 => {
3873 Name => 'Face15Size',
3874 Format => 'int16u[2]',
3875 RawConv => '$$self{FacesDetected} < 15 ? undef : $val',
3876 },
3877 30 => {
3878 Name => 'Face16Size',
3879 Format => 'int16u[2]',
3880 RawConv => '$$self{FacesDetected} < 16 ? undef : $val',
3881 },
3882 32 => {
3883 Name => 'Face17Size',
3884 Format => 'int16u[2]',
3885 RawConv => '$$self{FacesDetected} < 17 ? undef : $val',
3886 },
3887 34 => {
3888 Name => 'Face18Size',
3889 Format => 'int16u[2]',
3890 RawConv => '$$self{FacesDetected} < 18 ? undef : $val',
3891 },
3892 36 => {
3893 Name => 'Face19Size',
3894 Format => 'int16u[2]',
3895 RawConv => '$$self{FacesDetected} < 19 ? undef : $val',
3896 },
3897 38 => {
3898 Name => 'Face20Size',
3899 Format => 'int16u[2]',
3900 RawConv => '$$self{FacesDetected} < 20 ? undef : $val',
3901 },
3902 40 => {
3903 Name => 'Face21Size',
3904 Format => 'int16u[2]',
3905 RawConv => '$$self{FacesDetected} < 21 ? undef : $val',
3906 },
3907 42 => {
3908 Name => 'Face22Size',
3909 Format => 'int16u[2]',
3910 RawConv => '$$self{FacesDetected} < 22 ? undef : $val',
3911 },
3912 44 => {
3913 Name => 'Face23Size',
3914 Format => 'int16u[2]',
3915 RawConv => '$$self{FacesDetected} < 23 ? undef : $val',
3916 },
3917 46 => {
3918 Name => 'Face24Size',
3919 Format => 'int16u[2]',
3920 RawConv => '$$self{FacesDetected} < 24 ? undef : $val',
3921 },
3922 48 => {
3923 Name => 'Face25Size',
3924 Format => 'int16u[2]',
3925 RawConv => '$$self{FacesDetected} < 25 ? undef : $val',
3926 },
3927 50 => {
3928 Name => 'Face26Size',
3929 Format => 'int16u[2]',
3930 RawConv => '$$self{FacesDetected} < 26 ? undef : $val',
3931 },
3932 52 => {
3933 Name => 'Face27Size',
3934 Format => 'int16u[2]',
3935 RawConv => '$$self{FacesDetected} < 27 ? undef : $val',
3936 },
3937 54 => {
3938 Name => 'Face28Size',
3939 Format => 'int16u[2]',
3940 RawConv => '$$self{FacesDetected} < 28 ? undef : $val',
3941 },
3942 56 => {
3943 Name => 'Face29Size',
3944 Format => 'int16u[2]',
3945 RawConv => '$$self{FacesDetected} < 29 ? undef : $val',
3946 },
3947 58 => {
3948 Name => 'Face30Size',
3949 Format => 'int16u[2]',
3950 RawConv => '$$self{FacesDetected} < 30 ? undef : $val',
3951 },
3952 60 => {
3953 Name => 'Face31Size',
3954 Format => 'int16u[2]',
3955 RawConv => '$$self{FacesDetected} < 31 ? undef : $val',
3956 },
3957 62 => {
3958 Name => 'Face32Size',
3959 Format => 'int16u[2]',
3960 RawConv => '$$self{FacesDetected} < 32 ? undef : $val',
3961 },
3962);
3963
3964# digital filter information - ref PH (K-5)
3965%Image::ExifTool::Pentax::FilterInfo = (
3966 %binaryDataAttrs,
3967 GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
3968 FORMAT => 'int8u',
3969 NOTES => q{
3970 The parameters associated with each type of digital filter are unique, and
3971 these settings are also extracted with the DigitalFilter tag. Information
3972 is not extracted for filters that are "Off" unless the Unknown option is
3973 used.
3974 },
3975 0 => {
3976 Name => 'SourceDirectoryIndex',
3977 Format => 'int16u',
3978 },
3979 2 => {
3980 Name => 'SourceFileIndex',
3981 Format => 'int16u',
3982 },
3983 0x005 => { Name => 'DigitalFilter01', %digitalFilter },
3984 0x016 => { Name => 'DigitalFilter02', %digitalFilter },
3985 0x027 => { Name => 'DigitalFilter03', %digitalFilter },
3986 0x038 => { Name => 'DigitalFilter04', %digitalFilter },
3987 0x049 => { Name => 'DigitalFilter05', %digitalFilter },
3988 0x05a => { Name => 'DigitalFilter06', %digitalFilter },
3989 0x06b => { Name => 'DigitalFilter07', %digitalFilter },
3990 0x07c => { Name => 'DigitalFilter08', %digitalFilter },
3991 0x08d => { Name => 'DigitalFilter09', %digitalFilter },
3992 0x09e => { Name => 'DigitalFilter10', %digitalFilter },
3993 0x0af => { Name => 'DigitalFilter11', %digitalFilter },
3994 0x0c0 => { Name => 'DigitalFilter12', %digitalFilter },
3995 0x0d1 => { Name => 'DigitalFilter13', %digitalFilter },
3996 0x0e2 => { Name => 'DigitalFilter14', %digitalFilter },
3997 0x0f3 => { Name => 'DigitalFilter15', %digitalFilter },
3998 0x104 => { Name => 'DigitalFilter16', %digitalFilter },
3999 0x115 => { Name => 'DigitalFilter17', %digitalFilter },
4000 0x126 => { Name => 'DigitalFilter18', %digitalFilter },
4001 0x137 => { Name => 'DigitalFilter19', %digitalFilter },
4002 0x148 => { Name => 'DigitalFilter20', %digitalFilter },
4003);
4004
4005# electronic level information - ref PH (K-5)
4006%Image::ExifTool::Pentax::LevelInfo = (
4007 %binaryDataAttrs,
4008 GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
4009 FORMAT => 'int8s',
4010 NOTES => 'Tags decoded from the electronic level information.',
4011 0 => {
4012 Name => 'LevelOrientation',
4013 Mask => 0x0f,
4014 PrintHex => 0,
4015 PrintConv => {
4016 1 => 'Horizontal (normal)',
4017 2 => 'Rotate 180',
4018 3 => 'Rotate 90 CW',
4019 4 => 'Rotate 270 CW',
4020 9 => 'Horizontal; Off Level',
4021 10 => 'Rotate 180; Off Level',
4022 11 => 'Rotate 90 CW; Off Level',
4023 12 => 'Rotate 270 CW; Off Level',
4024 13 => 'Upwards',
4025 14 => 'Downwards',
4026 },
4027 },
4028 0.1 => {
4029 Name => 'CompositionAdjust',
4030 Mask => 0xf0,
4031 PrintConv => {
4032 0x00 => 'Off',
4033 0x20 => 'Composition Adjust',
4034 0xa0 => 'Composition Adjust + Horizon Correction',
4035 0xc0 => 'Horizon Correction',
4036 },
4037 },
4038 1 => {
4039 Name => 'RollAngle',
4040 Notes => 'degrees of clockwise camera rotation',
4041 ValueConv => '-$val / 2',
4042 ValueConvInv => '-$val * 2',
4043 },
4044 2 => {
4045 Name => 'PitchAngle',
4046 Notes => 'degrees of upward camera tilt',
4047 ValueConv => '-$val / 2',
4048 ValueConvInv => '-$val * 2',
4049 },
4050 # 3,4 - related somehow to horizon correction and composition adjust
4051 # 5,6,7 - (the notes below refer to how the image moves in the LCD monitor)
4052 5 => {
4053 Name => 'CompositionAdjustX',
4054 Notes => 'steps to the right, 1/16 mm per step',
4055 ValueConv => '-$val',
4056 ValueConvInv => '-$val',
4057 },
4058 6 => {
4059 Name => 'CompositionAdjustY',
4060 Notes => 'steps up, 1/16 mm per step',
4061 ValueConv => '-$val',
4062 ValueConvInv => '-$val',
4063 },
4064 7 => {
4065 Name => 'CompositionAdjustRotation',
4066 Notes => 'steps clockwise, 1/8 degree per step',
4067 ValueConv => '-$val / 2',
4068 ValueConvInv => '-$val * 2',
4069 },
4070);
4071
4072# temperature information for the K5 - PH
4073%Image::ExifTool::Pentax::TempInfoK5 = (
4074 %binaryDataAttrs,
4075 GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
4076 NOTES => q{
4077 A number of additional temperature readings are extracted from this 256-byte
4078 binary-data block in images from the K-5. It is not currently known where
4079 the corresponding temperature sensors are located in the camera.
4080 },
4081 # (it would be nice to know where these temperature sensors are located,
4082 # but since according to the manual the Slow Shutter Speed NR Auto mode
4083 # is based on "internal temperature", my guess is that there must be
4084 # at least one on the sensor itself. These temperatures seem to rise
4085 # more quickly than CameraTemperature when shooting video.)
4086 0x0c => {
4087 Name => 'CameraTemperature2',
4088 Format => 'int16s',
4089 ValueConv => '$val / 10',
4090 ValueConvInv => '$val * 10',
4091 PrintConv => 'sprintf("%.1f C", $val)',
4092 PrintConvInv => '$val=~s/ ?c$//i; $val',
4093 },
4094 0x0e => {
4095 Name => 'CameraTemperature3',
4096 Format => 'int16s',
4097 ValueConv => '$val / 10',
4098 ValueConvInv => '$val * 10',
4099 PrintConv => 'sprintf("%.1f C", $val)',
4100 PrintConvInv => '$val=~s/ ?c$//i; $val',
4101 },
4102 0x14 => {
4103 Name => 'CameraTemperature4',
4104 Format => 'int16s',
4105 PrintConv => '"$val C"',
4106 PrintConvInv => '$val=~s/ ?c$//i; $val',
4107 },
4108 0x16 => { # usually the same as CameraTemperature4, but not always
4109 Name => 'CameraTemperature5',
4110 Format => 'int16s',
4111 PrintConv => '"$val C"',
4112 PrintConvInv => '$val=~s/ ?c$//i; $val',
4113 },
4114);
4115
4116# currently unknown info
4117%Image::ExifTool::Pentax::UnknownInfo = (
4118 %binaryDataAttrs,
4119 GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
4120 # K10D: first 8 bytes seem to be short integers which change with ISO (value
4121 # is usually close to ISO/100) possibly smoothing or gain parameters? - PH
4122 # byte 0-1 - Higher for high color temperatures (red boost or red noise suppression?)
4123 # byte 6-7 - Higher for low color temperatures (blue boost or blue noise suppression?)
4124 # also changing are bytes 10,11,14,15
4125);
4126
4127# Pentax type 2 (Casio-like) maker notes (ref 1)
4128%Image::ExifTool::Pentax::Type2 = (
4129 WRITE_PROC => \&Image::ExifTool::Exif::WriteExif,
4130 CHECK_PROC => \&Image::ExifTool::Exif::CheckExif,
4131 GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
4132 WRITABLE => 'int16u',
4133 NOTES => q{
4134 These tags are used by the Pentax Optio 330 and 430, and are similar to the
4135 tags used by Casio.
4136 },
4137 0x0001 => {
4138 Name => 'RecordingMode',
4139 PrintConv => {
4140 0 => 'Auto',
4141 1 => 'Night Scene',
4142 2 => 'Manual',
4143 },
4144 },
4145 0x0002 => {
4146 Name => 'Quality',
4147 PrintConv => {
4148 0 => 'Good',
4149 1 => 'Better',
4150 2 => 'Best',
4151 },
4152 },
4153 0x0003 => {
4154 Name => 'FocusMode',
4155 PrintConv => {
4156 2 => 'Custom',
4157 3 => 'Auto',
4158 },
4159 },
4160 0x0004 => {
4161 Name => 'FlashMode',
4162 PrintConv => {
4163 1 => 'Auto',
4164 2 => 'On',
4165 4 => 'Off',
4166 6 => 'Red-eye reduction',
4167 },
4168 },
4169 # Casio 0x0005 is FlashIntensity
4170 # Casio 0x0006 is ObjectDistance
4171 0x0007 => {
4172 Name => 'WhiteBalance',
4173 PrintConv => {
4174 0 => 'Auto',
4175 1 => 'Daylight',
4176 2 => 'Shade',
4177 3 => 'Tungsten',
4178 4 => 'Fluorescent',
4179 5 => 'Manual',
4180 },
4181 },
4182 0x000a => {
4183 Name => 'DigitalZoom',
4184 Writable => 'int32u',
4185 },
4186 0x000b => {
4187 Name => 'Sharpness',
4188 PrintConv => {
4189 0 => 'Normal',
4190 1 => 'Soft',
4191 2 => 'Hard',
4192 },
4193 },
4194 0x000c => {
4195 Name => 'Contrast',
4196 PrintConv => {
4197 0 => 'Normal',
4198 1 => 'Low',
4199 2 => 'High',
4200 },
4201 },
4202 0x000d => {
4203 Name => 'Saturation',
4204 PrintConv => {
4205 0 => 'Normal',
4206 1 => 'Low',
4207 2 => 'High',
4208 },
4209 },
4210 0x0014 => {
4211 Name => 'ISO',
4212 Priority => 0,
4213 PrintConv => {
4214 10 => 100,
4215 16 => 200,
4216 50 => 50, #PH
4217 100 => 100, #PH
4218 200 => 200, #PH
4219 400 => 400, #PH
4220 800 => 800, #PH
4221 1600 => 1600, #PH
4222 3200 => 3200, #PH
4223 },
4224 },
4225 0x0017 => {
4226 Name => 'ColorFilter',
4227 PrintConv => {
4228 1 => 'Full',
4229 2 => 'Black & White',
4230 3 => 'Sepia',
4231 },
4232 },
4233 # Casio 0x0018 is AFPoint
4234 # Casio 0x0019 is FlashIntensity
4235 0x0e00 => {
4236 Name => 'PrintIM',
4237 Description => 'Print Image Matching',
4238 Writable => 0,
4239 SubDirectory => {
4240 TagTable => 'Image::ExifTool::PrintIM::Main',
4241 },
4242 },
4243 0x1000 => {
4244 Name => 'HometownCityCode',
4245 Writable => 'undef',
4246 Count => 4,
4247 },
4248 0x1001 => { #PH
4249 Name => 'DestinationCityCode',
4250 Writable => 'undef',
4251 Count => 4,
4252 },
4253);
4254
4255# ASCII-based maker notes of Optio E20 and E25 - PH
4256%Image::ExifTool::Pentax::Type4 = (
4257 PROCESS_PROC => \&Image::ExifTool::HP::ProcessHP,
4258 GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
4259 NOTES => q{
4260 The following few tags are extracted from the wealth of information
4261 available in maker notes of the Optio E20 and E25. These maker notes are
4262 stored as ASCII text in a format very similar to some HP models.
4263 },
4264 'F/W Version' => 'FirmwareVersion',
4265);
4266
4267# tags in Pentax QuickTime videos (PH - tests with Optio WP)
4268# (similar information in Kodak,Minolta,Nikon,Olympus,Pentax and Sanyo videos)
4269%Image::ExifTool::Pentax::MOV = (
4270 PROCESS_PROC => \&Image::ExifTool::ProcessBinaryData,
4271 GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
4272 FIRST_ENTRY => 0,
4273 NOTES => 'This information is found in Pentax MOV videos.',
4274 0x00 => {
4275 Name => 'Make',
4276 Format => 'string[24]',
4277 },
4278 # (01 00 at offset 0x20)
4279 0x26 => {
4280 Name => 'ExposureTime',
4281 Format => 'int32u',
4282 ValueConv => '$val ? 10 / $val : 0',
4283 PrintConv => 'Image::ExifTool::Exif::PrintExposureTime($val)',
4284 },
4285 0x2a => {
4286 Name => 'FNumber',
4287 Format => 'rational64u',
4288 PrintConv => 'sprintf("%.1f",$val)',
4289 },
4290 0x32 => {
4291 Name => 'ExposureCompensation',
4292 Format => 'rational64s',
4293 PrintConv => '$val ? sprintf("%+.1f", $val) : 0',
4294 },
4295 0x44 => {
4296 Name => 'WhiteBalance',
4297 Format => 'int16u',
4298 PrintConv => {
4299 0 => 'Auto',
4300 1 => 'Daylight',
4301 2 => 'Shade',
4302 3 => 'Fluorescent', #2
4303 4 => 'Tungsten',
4304 5 => 'Manual',
4305 },
4306 },
4307 0x48 => {
4308 Name => 'FocalLength',
4309 Format => 'rational64u',
4310 PrintConv => 'sprintf("%.1f mm",$val)',
4311 },
4312 0xaf => {
4313 Name => 'ISO',
4314 Format => 'int16u',
4315 },
4316);
4317
4318# Pentax metadata in AVI videos (PH)
4319%Image::ExifTool::Pentax::AVI = (
4320 NOTES => 'Pentax-specific RIFF tags found in AVI videos.',
4321 GROUPS => { 0 => 'MakerNotes', 2 => 'Video' },
4322 hymn => {
4323 Name => 'MakerNotes',
4324 SubDirectory => {
4325 TagTable => 'Image::ExifTool::Pentax::Main',
4326 Start => 10,
4327 Base => '$start',
4328 ByteOrder => 'BigEndian',
4329 },
4330 },
4331);
4332
4333# Pentax metadata in AVI videos from the RS1000 (PH)
4334%Image::ExifTool::Pentax::Junk = (
4335 NOTES => 'Tags found in the JUNK chunk of AVI videos from the RS1000.',
4336 PROCESS_PROC => \&Image::ExifTool::ProcessBinaryData,
4337 GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
4338 0x0c => {
4339 Name => 'Model',
4340 Format => 'string[32]',
4341 },
4342);
4343
4344#------------------------------------------------------------------------------
4345# Convert filter settings (ref PH, K-5)
4346# Inputs: 0) value to convert, 1) flag for inverse conversion, 2) lookup table
4347# Returns: converted value
4348sub PrintFilter($$$)
4349{
4350 my ($val, $inv, $conv) = @_;
4351 my (@vals, @cval, $t, $v);
4352
4353 if (not $inv) {
4354 # forward conversion (reading):
4355 @vals = split ' ',$val;
4356 $t = shift @vals;
4357 push @cval, $$conv{$t} || "Unknown ($t)";
4358 while (@vals) {
4359 $t = shift @vals;
4360 $v = shift @vals;
4361 next unless $t;
4362 last unless defined $v;
4363 my $c = $filterSettings{$t};
4364 if ($c) {
4365 my $c1 = $$c[1];
4366 if (ref $c1) {
4367 $v = $$c1{$v} || "Unknown($v)";
4368 } elsif ($v) {
4369 $v = sprintf $c1, $v;
4370 }
4371 push @cval, "$$c[0]=$v";
4372 } else {
4373 push @cval, "Unknown($t)=$v";
4374 }
4375 }
4376 return @cval ? \@cval : undef;
4377 } else {
4378 # reverse conversion (writing):
4379 @vals = split /,\s*/, $val;
4380 # convert filter name
4381 delete $$conv{OTHER}; # avoid recursion
4382 $v = Image::ExifTool::ReverseLookup(shift(@vals), $conv);
4383 $$conv{OTHER} = \&PrintFilter;
4384 return undef unless defined $v;
4385 push @cval, $v;
4386 # generate a lookup table for the filter setting name
4387 my %settingNames;
4388 $settingNames{$_} = $filterSettings{$_}[0] foreach keys %filterSettings;
4389 # convert filter settings
4390 foreach $v (@vals) {
4391 $v =~ /^(.*)=(.*)$/ or return undef;
4392 ($t, $v) = ($1, $2);
4393 # look up settings name
4394 $t = Image::ExifTool::ReverseLookup($t, \%settingNames);
4395 return undef unless defined $t;
4396 if (ref $filterSettings{$t}[1]) {
4397 # look up settings value
4398 $v = Image::ExifTool::ReverseLookup($v, $filterSettings{$t}[1]);
4399 return undef unless defined $v;
4400 } else {
4401 return undef unless Image::ExifTool::IsInt($v);
4402 }
4403 push @cval, $t, $v;
4404 }
4405 push @cval, (0) x (17 - @cval) if @cval < 17; # pad with zeros if necessary
4406 return join(' ', @cval);
4407 }
4408}
4409
4410#------------------------------------------------------------------------------
4411# Convert Pentax hex-based EV (modulo 8) to real number
4412# Inputs: 0) value to convert
4413# ie) 0x00 -> 0
4414# 0x03 -> 0.33333
4415# 0x04 -> 0.5
4416# 0x05 -> 0.66666
4417# 0x08 -> 1 ... etc
4418sub PentaxEv($)
4419{
4420 my $val = shift;
4421 if ($val & 0x01) {
4422 my $sign = $val < 0 ? -1 : 1;
4423 my $frac = ($val * $sign) & 0x07;
4424 if ($frac == 0x03) {
4425 $val += $sign * ( 8 / 3 - $frac);
4426 } elsif ($frac == 0x05) {
4427 $val += $sign * (16 / 3 - $frac);
4428 }
4429 }
4430 return $val / 8;
4431}
4432
4433#------------------------------------------------------------------------------
4434# Convert number to Pentax hex-based EV (modulo 8)
4435# Inputs: 0) number
4436# Returns: Pentax EV code
4437sub PentaxEvInv($)
4438{
4439 my $num = shift;
4440 my $val = $num * 8;
4441 # extra fudging makes sure 0.3 and 0.33333 both round up to 3, etc
4442 my $sign = $num < 0 ? -1 : 1;
4443 my $inum = $num * $sign - int($num * $sign);
4444 if ($inum > 0.29 and $inum < 0.4) {
4445 $val += $sign / 3;
4446 } elsif ($inum > 0.6 and $inum < .71) {
4447 $val -= $sign / 3;
4448 }
4449 return int($val + 0.5 * $sign);
4450}
4451
4452#------------------------------------------------------------------------------
4453# Encrypt or decrypt Pentax ShutterCount (symmetrical encryption) - PH
4454# Inputs: 0) shutter count value, 1) ExifTool object ref
4455# Returns: Encrypted or decrypted ShutterCount
4456sub CryptShutterCount($$)
4457{
4458 my ($val, $exifTool) = @_;
4459 # Pentax Date and Time values are used in the encryption
4460 return undef unless $$exifTool{PentaxDate} and $$exifTool{PentaxTime} and
4461 length($$exifTool{PentaxDate})==4 and length($$exifTool{PentaxTime})>=3;
4462 # get Date and Time as integers (after padding Time with a null byte)
4463 my $date = unpack('N', $$exifTool{PentaxDate});
4464 my $time = unpack('N', $$exifTool{PentaxTime} . "\0");
4465 return $val ^ $date ^ (0xffffffff - $time);
4466}
4467
4468
44691; # end
4470
4471__END__
4472
4473=head1 NAME
4474
4475Image::ExifTool::Pentax - Pentax/Asahi maker notes tags
4476
4477=head1 SYNOPSIS
4478
4479This module is loaded automatically by Image::ExifTool when required.
4480
4481=head1 DESCRIPTION
4482
4483This module contains definitions required by Image::ExifTool to interpret
4484Pentax and Asahi maker notes in EXIF information.
4485
4486=head1 NOTES
4487
4488I couldn't find a good source for Pentax maker notes information, but I've
4489managed to discover a fair bit of information by analyzing sample images
4490downloaded from the internet, and through tests with my own Optio WP,
4491K10D, and K-5, and with help provided by other ExifTool users (see
4492L</ACKNOWLEDGEMENTS>).
4493
4494The Pentax maker notes are stored in standard EXIF format, but the offsets
4495used for some of their cameras are wacky. The Optio 330 gives the offset
4496relative to the offset of the tag in the directory, the Optio WP uses a base
4497offset in the middle of nowhere, and the Optio 550 uses different (and
4498totally illogical) bases for different menu entries. Very weird. (It
4499wouldn't surprise me if Pentax can't read their own maker notes!) Luckily,
4500there are only a few entries in the maker notes which are large enough to
4501require offsets, so this doesn't affect much useful information. ExifTool
4502attempts to make sense of this fiasco by making an assumption about where
4503the information should be stored to deduce the correct offsets.
4504
4505=head1 REFERENCES
4506
4507=over 4
4508
4509=item L<Image::MakerNotes::Pentax|Image::MakerNotes::Pentax>
4510
4511=item L<http://johnst.org/sw/exiftags/> (Asahi models)
4512
4513=item L<http://kobe1995.jp/~kaz/astro/istD.html>
4514
4515=item L<http://www.cybercom.net/~dcoffin/dcraw/>
4516
4517=item (...plus lots of testing with my Optio WP, K10D and K-5!)
4518
4519=back
4520
4521=head1 ACKNOWLEDGEMENTS
4522
4523Thanks to Wayne Smith, John Francis, Douglas O'Brien Cvetan Ivanov, Jens
4524Duttke and Dave Nicholson for help figuring out some Pentax tags, Ger
4525Vermeulen and Niels Kristian Bech Jensen for contributing print conversion
4526values for some tags, and everyone who helped contribute to the LensType
4527values.
4528
4529=head1 AUTHOR
4530
4531Copyright 2003-2011, Phil Harvey (phil at owl.phy.queensu.ca)
4532
4533This library is free software; you can redistribute it and/or modify it
4534under the same terms as Perl itself.
4535
4536=head1 SEE ALSO
4537
4538L<Image::ExifTool::TagNames/Pentax Tags>,
4539L<Image::ExifTool(3pm)|Image::ExifTool>,
4540L<Image::Info(3pm)|Image::Info>
4541
4542=cut
Note: See TracBrowser for help on using the repository browser.