source: gs2-extensions/parallel-building/trunk/src/perllib/cpan/Image/ExifTool/Nikon.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: 190.9 KB
Line 
1#------------------------------------------------------------------------------
2# File: Nikon.pm
3#
4# Description: Nikon EXIF maker notes tags
5#
6# Revisions: 12/09/2003 - P. Harvey Created
7# 05/17/2004 - P. Harvey Added information from Joseph Heled
8# 09/21/2004 - P. Harvey Changed tag 2 to ISOUsed & added PrintConv
9# 12/01/2004 - P. Harvey Added default PRINT_CONV
10# 01/01/2005 - P. Harvey Decode preview image and preview IFD
11# 03/35/2005 - T. Christiansen additions
12# 05/10/2005 - P. Harvey Decode encrypted lens data
13# [ongoing] - P. Harvey Constantly decoding new information
14#
15# References: 1) http://park2.wakwak.com/~tsuruzoh/Computer/Digicams/exif-e.html
16# 2) Joseph Heled private communication (tests with D70)
17# 3) Thomas Walter private communication (tests with Coolpix 5400)
18# 4) http://www.cybercom.net/~dcoffin/dcraw/
19# 5) Brian Ristuccia private communication (tests with D70)
20# 6) Danek Duvall private communication (tests with D70)
21# 7) Tom Christiansen private communication (tests with D70)
22# 8) Robert Rottmerhusen private communication
23# 9) http://members.aol.com/khancock/pilot/nbuddy/
24# 10) Werner Kober private communication (D2H, D2X, D100, D70, D200, D90)
25# 11) http://www.rottmerhusen.com/objektives/lensid/thirdparty.html
26# 12) http://libexif.sourceforge.net/internals/mnote-olympus-tag_8h-source.html
27# 13) Roger Larsson private communication (tests with D200)
28# 14) http://homepage3.nifty.com/kamisaka/makernote/makernote_nikon.htm (2007/09/15)
29# 15) http://tomtia.plala.jp/DigitalCamera/MakerNote/index.asp
30# 16) Jeffrey Friedl private communication (D200 with firmware update)
31# 17) http://www.wohlberg.net/public/software/photo/nstiffexif/
32# and Brendt Wohlberg private communication
33# 18) Anonymous user private communication (D70, D200, D2x)
34# 19) Bruce Stevens private communication
35# 20) Vladimir Sauta private communication (D80)
36# 21) Gregor Dorlars private communication (D300)
37# 22) Tanel Kuusk private communication
38# 23) Alexandre Naaman private communication (D3)
39# 24) Geert De Soete private communication
40# 25) Niels Kristian private communication
41# 26) Bozi (http://www.cpanforum.com/posts/8983)
42# 27) Jens Kriese private communication
43# 28) Warren Hatch private communication (D3v2.00 with SB-800 and SB-900)
44# 29) Anonymous contribution 2011/05/25 (D700, D7000)
45# JD) Jens Duttke private communication
46#------------------------------------------------------------------------------
47
48package Image::ExifTool::Nikon;
49
50use strict;
51use vars qw($VERSION);
52use Image::ExifTool qw(:DataAccess :Utils);
53use Image::ExifTool::Exif;
54
55$VERSION = '2.47';
56
57sub LensIDConv($$$);
58sub ProcessNikonAVI($$$);
59sub ProcessNikonMOV($$$);
60sub FormatString($);
61sub ProcessNikonCaptureEditVersions($$$);
62
63# nikon lens ID numbers (ref 8/11)
64my %nikonLensIDs = (
65 Notes => q{
66 The Nikon LensID is constructed as a Composite tag from the raw hex values
67 of 8 other tags: LensIDNumber, LensFStops, MinFocalLength, MaxFocalLength,
68 MaxApertureAtMinFocal, MaxApertureAtMaxFocal, MCUVersion and LensType, in
69 that order. (source:
70 L<http://www.rottmerhusen.com/objektives/lensid/thirdparty.html>.) Multiple
71 lenses with the same LensID are differentiated by decimal values in the list
72 below. The user-defined "Lenses" list may be used to specify the lens for
73 ExifTool to choose in these cases (see the
74 L<sample config file|../config.html> for details).
75 },
76 OTHER => \&LensIDConv,
77 # Note: Sync this list with Robert's Perl version at
78 # http://www.rottmerhusen.com/objektives/lensid/files/exif/fmountlens.p.txt
79 # (hex digits must be uppercase in keys below)
80 '01 58 50 50 14 14 02 00' => 'AF Nikkor 50mm f/1.8',
81 '02 42 44 5C 2A 34 02 00' => 'AF Zoom-Nikkor 35-70mm f/3.3-4.5',
82 '02 42 44 5C 2A 34 08 00' => 'AF Zoom-Nikkor 35-70mm f/3.3-4.5',
83 '03 48 5C 81 30 30 02 00' => 'AF Zoom-Nikkor 70-210mm f/4',
84 '04 48 3C 3C 24 24 03 00' => 'AF Nikkor 28mm f/2.8',
85 '05 54 50 50 0C 0C 04 00' => 'AF Nikkor 50mm f/1.4',
86 '06 54 53 53 24 24 06 00' => 'AF Micro-Nikkor 55mm f/2.8',
87 '07 40 3C 62 2C 34 03 00' => 'AF Zoom-Nikkor 28-85mm f/3.5-4.5',
88 '08 40 44 6A 2C 34 04 00' => 'AF Zoom-Nikkor 35-105mm f/3.5-4.5',
89 '09 48 37 37 24 24 04 00' => 'AF Nikkor 24mm f/2.8',
90 '0A 48 8E 8E 24 24 03 00' => 'AF Nikkor 300mm f/2.8 IF-ED',
91 '0A 48 8E 8E 24 24 05 00' => 'AF Nikkor 300mm f/2.8 IF-ED N',
92 '0B 48 7C 7C 24 24 05 00' => 'AF Nikkor 180mm f/2.8 IF-ED',
93 '0D 40 44 72 2C 34 07 00' => 'AF Zoom-Nikkor 35-135mm f/3.5-4.5',
94 '0E 48 5C 81 30 30 05 00' => 'AF Zoom-Nikkor 70-210mm f/4',
95 '0F 58 50 50 14 14 05 00' => 'AF Nikkor 50mm f/1.8 N',
96 '10 48 8E 8E 30 30 08 00' => 'AF Nikkor 300mm f/4 IF-ED',
97 '11 48 44 5C 24 24 08 00' => 'AF Zoom-Nikkor 35-70mm f/2.8',
98 '12 48 5C 81 30 3C 09 00' => 'AF Nikkor 70-210mm f/4-5.6',
99 '13 42 37 50 2A 34 0B 00' => 'AF Zoom-Nikkor 24-50mm f/3.3-4.5',
100 '14 48 60 80 24 24 0B 00' => 'AF Zoom-Nikkor 80-200mm f/2.8 ED',
101 '15 4C 62 62 14 14 0C 00' => 'AF Nikkor 85mm f/1.8',
102 '17 3C A0 A0 30 30 0F 00' => 'Nikkor 500mm f/4 P ED IF',
103 '17 3C A0 A0 30 30 11 00' => 'Nikkor 500mm f/4 P ED IF',
104 '18 40 44 72 2C 34 0E 00' => 'AF Zoom-Nikkor 35-135mm f/3.5-4.5 N',
105 '1A 54 44 44 18 18 11 00' => 'AF Nikkor 35mm f/2',
106 '1B 44 5E 8E 34 3C 10 00' => 'AF Zoom-Nikkor 75-300mm f/4.5-5.6',
107 '1C 48 30 30 24 24 12 00' => 'AF Nikkor 20mm f/2.8',
108 '1D 42 44 5C 2A 34 12 00' => 'AF Zoom-Nikkor 35-70mm f/3.3-4.5 N',
109 '1E 54 56 56 24 24 13 00' => 'AF Micro-Nikkor 60mm f/2.8',
110 '1F 54 6A 6A 24 24 14 00' => 'AF Micro-Nikkor 105mm f/2.8',
111 '20 48 60 80 24 24 15 00' => 'AF Zoom-Nikkor 80-200mm f/2.8 ED',
112 '21 40 3C 5C 2C 34 16 00' => 'AF Zoom-Nikkor 28-70mm f/3.5-4.5',
113 '22 48 72 72 18 18 16 00' => 'AF DC-Nikkor 135mm f/2',
114 '23 30 BE CA 3C 48 17 00' => 'Zoom-Nikkor 1200-1700mm f/5.6-8 P ED IF',
115 '24 48 60 80 24 24 1A 02' => 'AF Zoom-Nikkor 80-200mm f/2.8D ED',
116 '25 48 44 5C 24 24 1B 02' => 'AF Zoom-Nikkor 35-70mm f/2.8D',
117 '25 48 44 5C 24 24 52 02' => 'AF Zoom-Nikkor 35-70mm f/2.8D',
118 '26 40 3C 5C 2C 34 1C 02' => 'AF Zoom-Nikkor 28-70mm f/3.5-4.5D',
119 '27 48 8E 8E 24 24 1D 02' => 'AF-I Nikkor 300mm f/2.8D IF-ED',
120 '27 48 8E 8E 24 24 F1 02' => 'AF-I Nikkor 300mm f/2.8D IF-ED + TC-14E',
121 '27 48 8E 8E 24 24 E1 02' => 'AF-I Nikkor 300mm f/2.8D IF-ED + TC-17E',
122 '27 48 8E 8E 24 24 F2 02' => 'AF-I Nikkor 300mm f/2.8D IF-ED + TC-20E',
123 '28 3C A6 A6 30 30 1D 02' => 'AF-I Nikkor 600mm f/4D IF-ED',
124 '28 3C A6 A6 30 30 F1 02' => 'AF-I Nikkor 600mm f/4D IF-ED + TC-14E',
125 '28 3C A6 A6 30 30 E1 02' => 'AF-I Nikkor 600mm f/4D IF-ED + TC-17E',
126 '28 3C A6 A6 30 30 F2 02' => 'AF-I Nikkor 600mm f/4D IF-ED + TC-20E',
127 '2A 54 3C 3C 0C 0C 26 02' => 'AF Nikkor 28mm f/1.4D',
128 '2B 3C 44 60 30 3C 1F 02' => 'AF Zoom-Nikkor 35-80mm f/4-5.6D',
129 '2C 48 6A 6A 18 18 27 02' => 'AF DC-Nikkor 105mm f/2D',
130 '2D 48 80 80 30 30 21 02' => 'AF Micro-Nikkor 200mm f/4D IF-ED',
131 '2E 48 5C 82 30 3C 22 02' => 'AF Nikkor 70-210mm f/4-5.6D',
132 '2E 48 5C 82 30 3C 28 02' => 'AF Nikkor 70-210mm f/4-5.6D',
133 '2F 48 30 44 24 24 29 02.1' => 'AF Zoom-Nikkor 20-35mm f/2.8D IF',
134 '30 48 98 98 24 24 24 02' => 'AF-I Nikkor 400mm f/2.8D IF-ED',
135 '30 48 98 98 24 24 F1 02' => 'AF-I Nikkor 400mm f/2.8D IF-ED + TC-14E',
136 '30 48 98 98 24 24 E1 02' => 'AF-I Nikkor 400mm f/2.8D IF-ED + TC-17E',
137 '30 48 98 98 24 24 F2 02' => 'AF-I Nikkor 400mm f/2.8D IF-ED + TC-20E',
138 '31 54 56 56 24 24 25 02' => 'AF Micro-Nikkor 60mm f/2.8D',
139 '32 54 6A 6A 24 24 35 02.1' => 'AF Micro-Nikkor 105mm f/2.8D',
140 '33 48 2D 2D 24 24 31 02' => 'AF Nikkor 18mm f/2.8D',
141 '34 48 29 29 24 24 32 02' => 'AF Fisheye Nikkor 16mm f/2.8D',
142 '35 3C A0 A0 30 30 33 02' => 'AF-I Nikkor 500mm f/4D IF-ED',
143 '35 3C A0 A0 30 30 F1 02' => 'AF-I Nikkor 500mm f/4D IF-ED + TC-14E',
144 '35 3C A0 A0 30 30 E1 02' => 'AF-I Nikkor 500mm f/4D IF-ED + TC-17E',
145 '35 3C A0 A0 30 30 F2 02' => 'AF-I Nikkor 500mm f/4D IF-ED + TC-20E',
146 '36 48 37 37 24 24 34 02' => 'AF Nikkor 24mm f/2.8D',
147 '37 48 30 30 24 24 36 02' => 'AF Nikkor 20mm f/2.8D',
148 '38 4C 62 62 14 14 37 02' => 'AF Nikkor 85mm f/1.8D',
149 '3A 40 3C 5C 2C 34 39 02' => 'AF Zoom-Nikkor 28-70mm f/3.5-4.5D',
150 '3B 48 44 5C 24 24 3A 02' => 'AF Zoom-Nikkor 35-70mm f/2.8D N',
151 '3C 48 60 80 24 24 3B 02' => 'AF Zoom-Nikkor 80-200mm f/2.8D ED', #25
152 '3D 3C 44 60 30 3C 3E 02' => 'AF Zoom-Nikkor 35-80mm f/4-5.6D',
153 '3E 48 3C 3C 24 24 3D 02' => 'AF Nikkor 28mm f/2.8D',
154 '3F 40 44 6A 2C 34 45 02' => 'AF Zoom-Nikkor 35-105mm f/3.5-4.5D',
155 '41 48 7C 7C 24 24 43 02' => 'AF Nikkor 180mm f/2.8D IF-ED',
156 '42 54 44 44 18 18 44 02' => 'AF Nikkor 35mm f/2D',
157 '43 54 50 50 0C 0C 46 02' => 'AF Nikkor 50mm f/1.4D',
158 '44 44 60 80 34 3C 47 02' => 'AF Zoom-Nikkor 80-200mm f/4.5-5.6D',
159 '45 40 3C 60 2C 3C 48 02' => 'AF Zoom-Nikkor 28-80mm f/3.5-5.6D',
160 '46 3C 44 60 30 3C 49 02' => 'AF Zoom-Nikkor 35-80mm f/4-5.6D N',
161 '47 42 37 50 2A 34 4A 02' => 'AF Zoom-Nikkor 24-50mm f/3.3-4.5D',
162 '48 48 8E 8E 24 24 4B 02' => 'AF-S Nikkor 300mm f/2.8D IF-ED',
163 '48 48 8E 8E 24 24 F1 02' => 'AF-S Nikkor 300mm f/2.8D IF-ED + TC-14E',
164 '48 48 8E 8E 24 24 E1 02' => 'AF-S Nikkor 300mm f/2.8D IF-ED + TC-17E',
165 '48 48 8E 8E 24 24 F2 02' => 'AF-S Nikkor 300mm f/2.8D IF-ED + TC-20E',
166 '49 3C A6 A6 30 30 4C 02' => 'AF-S Nikkor 600mm f/4D IF-ED',
167 '49 3C A6 A6 30 30 F1 02' => 'AF-S Nikkor 600mm f/4D IF-ED + TC-14E',
168 '49 3C A6 A6 30 30 E1 02' => 'AF-S Nikkor 600mm f/4D IF-ED + TC-17E',
169 '49 3C A6 A6 30 30 F2 02' => 'AF-S Nikkor 600mm f/4D IF-ED + TC-20E',
170 '4A 54 62 62 0C 0C 4D 02' => 'AF Nikkor 85mm f/1.4D IF',
171 '4B 3C A0 A0 30 30 4E 02' => 'AF-S Nikkor 500mm f/4D IF-ED',
172 '4B 3C A0 A0 30 30 F1 02' => 'AF-S Nikkor 500mm f/4D IF-ED + TC-14E',
173 '4B 3C A0 A0 30 30 E1 02' => 'AF-S Nikkor 500mm f/4D IF-ED + TC-17E',
174 '4B 3C A0 A0 30 30 F2 02' => 'AF-S Nikkor 500mm f/4D IF-ED + TC-20E',
175 '4C 40 37 6E 2C 3C 4F 02' => 'AF Zoom-Nikkor 24-120mm f/3.5-5.6D IF',
176 '4D 40 3C 80 2C 3C 62 02' => 'AF Zoom-Nikkor 28-200mm f/3.5-5.6D IF',
177 '4E 48 72 72 18 18 51 02' => 'AF DC-Nikkor 135mm f/2D',
178 '4F 40 37 5C 2C 3C 53 06' => 'IX-Nikkor 24-70mm f/3.5-5.6',
179 '50 48 56 7C 30 3C 54 06' => 'IX-Nikkor 60-180mm f/4-5.6',
180 '53 48 60 80 24 24 57 02' => 'AF Zoom-Nikkor 80-200mm f/2.8D ED',
181 '53 48 60 80 24 24 60 02' => 'AF Zoom-Nikkor 80-200mm f/2.8D ED',
182 '54 44 5C 7C 34 3C 58 02' => 'AF Zoom-Micro Nikkor 70-180mm f/4.5-5.6D ED',
183 '56 48 5C 8E 30 3C 5A 02' => 'AF Zoom-Nikkor 70-300mm f/4-5.6D ED',
184 '59 48 98 98 24 24 5D 02' => 'AF-S Nikkor 400mm f/2.8D IF-ED',
185 '59 48 98 98 24 24 F1 02' => 'AF-S Nikkor 400mm f/2.8D IF-ED + TC-14E',
186 '59 48 98 98 24 24 E1 02' => 'AF-S Nikkor 400mm f/2.8D IF-ED + TC-17E',
187 '59 48 98 98 24 24 F2 02' => 'AF-S Nikkor 400mm f/2.8D IF-ED + TC-20E',
188 '5A 3C 3E 56 30 3C 5E 06' => 'IX-Nikkor 30-60mm f/4-5.6',
189 '5B 44 56 7C 34 3C 5F 06' => 'IX-Nikkor 60-180mm f/4.5-5.6',
190 '5D 48 3C 5C 24 24 63 02' => 'AF-S Zoom-Nikkor 28-70mm f/2.8D IF-ED',
191 '5E 48 60 80 24 24 64 02' => 'AF-S Zoom-Nikkor 80-200mm f/2.8D IF-ED',
192 '5F 40 3C 6A 2C 34 65 02' => 'AF Zoom-Nikkor 28-105mm f/3.5-4.5D IF',
193 '60 40 3C 60 2C 3C 66 02' => 'AF Zoom-Nikkor 28-80mm f/3.5-5.6D', #(http://www.exif.org/forum/topic.asp?TOPIC_ID=16)
194 '61 44 5E 86 34 3C 67 02' => 'AF Zoom-Nikkor 75-240mm f/4.5-5.6D',
195 '63 48 2B 44 24 24 68 02' => 'AF-S Nikkor 17-35mm f/2.8D IF-ED',
196 '64 00 62 62 24 24 6A 02' => 'PC Micro-Nikkor 85mm f/2.8D',
197 '65 44 60 98 34 3C 6B 0A' => 'AF VR Zoom-Nikkor 80-400mm f/4.5-5.6D ED',
198 '66 40 2D 44 2C 34 6C 02' => 'AF Zoom-Nikkor 18-35mm f/3.5-4.5D IF-ED',
199 '67 48 37 62 24 30 6D 02' => 'AF Zoom-Nikkor 24-85mm f/2.8-4D IF',
200 '68 42 3C 60 2A 3C 6E 06' => 'AF Zoom-Nikkor 28-80mm f/3.3-5.6G',
201 '69 48 5C 8E 30 3C 6F 06' => 'AF Zoom-Nikkor 70-300mm f/4-5.6G',
202 '6A 48 8E 8E 30 30 70 02' => 'AF-S Nikkor 300mm f/4D IF-ED',
203 '6B 48 24 24 24 24 71 02' => 'AF Nikkor ED 14mm f/2.8D',
204 '6D 48 8E 8E 24 24 73 02' => 'AF-S Nikkor 300mm f/2.8D IF-ED II',
205 '6E 48 98 98 24 24 74 02' => 'AF-S Nikkor 400mm f/2.8D IF-ED II',
206 '6F 3C A0 A0 30 30 75 02' => 'AF-S Nikkor 500mm f/4D IF-ED II',
207 '70 3C A6 A6 30 30 76 02' => 'AF-S Nikkor 600mm f/4D IF-ED II',
208 '72 48 4C 4C 24 24 77 00' => 'Nikkor 45mm f/2.8 P',
209 '74 40 37 62 2C 34 78 06' => 'AF-S Zoom-Nikkor 24-85mm f/3.5-4.5G IF-ED',
210 '75 40 3C 68 2C 3C 79 06' => 'AF Zoom-Nikkor 28-100mm f/3.5-5.6G',
211 '76 58 50 50 14 14 7A 02' => 'AF Nikkor 50mm f/1.8D',
212 '77 48 5C 80 24 24 7B 0E' => 'AF-S VR Zoom-Nikkor 70-200mm f/2.8G IF-ED',
213 '78 40 37 6E 2C 3C 7C 0E' => 'AF-S VR Zoom-Nikkor 24-120mm f/3.5-5.6G IF-ED',
214 '79 40 3C 80 2C 3C 7F 06' => 'AF Zoom-Nikkor 28-200mm f/3.5-5.6G IF-ED',
215 '7A 3C 1F 37 30 30 7E 06.1' => 'AF-S DX Zoom-Nikkor 12-24mm f/4G IF-ED',
216 '7B 48 80 98 30 30 80 0E' => 'AF-S VR Zoom-Nikkor 200-400mm f/4G IF-ED',
217 '7D 48 2B 53 24 24 82 06' => 'AF-S DX Zoom-Nikkor 17-55mm f/2.8G IF-ED',
218 '7F 40 2D 5C 2C 34 84 06' => 'AF-S DX Zoom-Nikkor 18-70mm f/3.5-4.5G IF-ED',
219 '80 48 1A 1A 24 24 85 06' => 'AF DX Fisheye-Nikkor 10.5mm f/2.8G ED',
220 '81 54 80 80 18 18 86 0E' => 'AF-S VR Nikkor 200mm f/2G IF-ED',
221 '82 48 8E 8E 24 24 87 0E' => 'AF-S VR Nikkor 300mm f/2.8G IF-ED',
222 '83 00 B0 B0 5A 5A 88 04' => 'FSA-L2, EDG 65, 800mm F13 G',
223 '89 3C 53 80 30 3C 8B 06' => 'AF-S DX Zoom-Nikkor 55-200mm f/4-5.6G ED',
224 '8A 54 6A 6A 24 24 8C 0E' => 'AF-S VR Micro-Nikkor 105mm f/2.8G IF-ED', #10
225 '8B 40 2D 80 2C 3C 8D 0E' => 'AF-S DX VR Zoom-Nikkor 18-200mm f/3.5-5.6G IF-ED',
226 '8B 40 2D 80 2C 3C FD 0E' => 'AF-S DX VR Zoom-Nikkor 18-200mm f/3.5-5.6G IF-ED [II]', #20
227 '8C 40 2D 53 2C 3C 8E 06' => 'AF-S DX Zoom-Nikkor 18-55mm f/3.5-5.6G ED',
228 '8D 44 5C 8E 34 3C 8F 0E' => 'AF-S VR Zoom-Nikkor 70-300mm f/4.5-5.6G IF-ED', #10
229 '8F 40 2D 72 2C 3C 91 06' => 'AF-S DX Zoom-Nikkor 18-135mm f/3.5-5.6G IF-ED',
230 '90 3B 53 80 30 3C 92 0E' => 'AF-S DX VR Zoom-Nikkor 55-200mm f/4-5.6G IF-ED',
231 '92 48 24 37 24 24 94 06' => 'AF-S Zoom-Nikkor 14-24mm f/2.8G ED',
232 '93 48 37 5C 24 24 95 06' => 'AF-S Zoom-Nikkor 24-70mm f/2.8G ED',
233 '94 40 2D 53 2C 3C 96 06' => 'AF-S DX Zoom-Nikkor 18-55mm f/3.5-5.6G ED II', #10 (D40)
234 '95 4C 37 37 2C 2C 97 02' => 'PC-E Nikkor 24mm f/3.5D ED',
235 '95 00 37 37 2C 2C 97 06' => 'PC-E Nikkor 24mm f/3.5D ED', #JD
236 '96 48 98 98 24 24 98 0E' => 'AF-S VR Nikkor 400mm f/2.8G ED',
237 '97 3C A0 A0 30 30 99 0E' => 'AF-S VR Nikkor 500mm f/4G ED',
238 '98 3C A6 A6 30 30 9A 0E' => 'AF-S VR Nikkor 600mm f/4G ED',
239 '99 40 29 62 2C 3C 9B 0E' => 'AF-S DX VR Zoom-Nikkor 16-85mm f/3.5-5.6G ED',
240 '9A 40 2D 53 2C 3C 9C 0E' => 'AF-S DX VR Zoom-Nikkor 18-55mm f/3.5-5.6G',
241 '9B 54 4C 4C 24 24 9D 02' => 'PC-E Micro Nikkor 45mm f/2.8D ED',
242 '9B 00 4C 4C 24 24 9D 06' => 'PC-E Micro Nikkor 45mm f/2.8D ED',
243 '9C 54 56 56 24 24 9E 06' => 'AF-S Micro Nikkor 60mm f/2.8G ED',
244 '9D 54 62 62 24 24 9F 02' => 'PC-E Micro Nikkor 85mm f/2.8D',
245 '9D 00 62 62 24 24 9F 06' => 'PC-E Micro Nikkor 85mm f/2.8D',
246 '9E 40 2D 6A 2C 3C A0 0E' => 'AF-S DX VR Zoom-Nikkor 18-105mm f/3.5-5.6G ED', #PH/10
247 '9F 58 44 44 14 14 A1 06' => 'AF-S DX Nikkor 35mm f/1.8G', #27
248 'A0 54 50 50 0C 0C A2 06' => 'AF-S Nikkor 50mm f/1.4G',
249 'A1 40 18 37 2C 34 A3 06' => 'AF-S DX Nikkor 10-24mm f/3.5-4.5G ED',
250 'A2 48 5C 80 24 24 A4 0E' => 'AF-S Nikkor 70-200mm f/2.8G ED VR II',
251 'A3 3C 29 44 30 30 A5 0E' => 'AF-S Nikkor 16-35mm f/4G ED VR',
252 'A4 54 37 37 0C 0C A6 06' => 'AF-S Nikkor 24mm f/1.4G ED',
253 'A5 40 3C 8E 2C 3C A7 0E' => 'AF-S Nikkor 28-300mm f/3.5-5.6G ED VR',
254 'A6 48 8E 8E 24 24 A8 0E' => 'AF-S VR Nikkor 300mm f/2.8G IF-ED II',
255 'A7 4B 62 62 2C 2C A9 0E' => 'AF-S DX Micro Nikkor 85mm f/3.5G ED VR',
256 'A9 54 80 80 18 18 AB 0E' => 'AF-S Nikkor 200mm f/2G ED VR II',
257 'AA 3C 37 6E 30 30 AC 0E' => 'AF-S Nikkor 24-120mm f/4G ED VR',
258 'AC 38 53 8E 34 3C AE 0E' => 'AF-S DX VR Nikkor 55-300mm 4.5-5.6G ED',
259 'AE 54 62 62 0C 0C B0 06' => 'AF-S Nikkor 85mm f/1.4G',
260 'AF 54 44 44 0C 0C B1 06' => 'AF-S Nikkor 35mm f/1.4G',
261 'B0 4C 50 50 14 14 B2 06' => 'AF-S Nikkor 50mm f/1.8G',
262 '01 00 00 00 00 00 02 00' => 'TC-16A',
263 '01 00 00 00 00 00 08 00' => 'TC-16A',
264 '00 00 00 00 00 00 F1 0C' => 'TC-14E [II] or Sigma APO Tele Converter 1.4x EX DG or Kenko Teleplus PRO 300 DG 1.4x',
265 '00 00 00 00 00 00 F2 18' => 'TC-20E [II] or Sigma APO Tele Converter 2x EX DG or Kenko Teleplus PRO 300 DG 2.0x',
266 '00 00 00 00 00 00 E1 12' => 'TC-17E II',
267 'FE 47 00 00 24 24 4B 06' => 'Sigma 4.5mm F2.8 EX DC HSM Circular Fisheye', #JD
268 '26 48 11 11 30 30 1C 02' => 'Sigma 8mm F4 EX Circular Fisheye',
269 '79 40 11 11 2C 2C 1C 06' => 'Sigma 8mm F3.5 EX Circular Fisheye', #JD
270 'DC 48 19 19 24 24 4B 06' => 'Sigma 10mm F2.8 EX DC HSM Fisheye',
271 '02 3F 24 24 2C 2C 02 00' => 'Sigma 14mm F3.5',
272 '48 48 24 24 24 24 4B 02' => 'Sigma 14mm F2.8 EX Aspherical HSM',
273 '26 48 27 27 24 24 1C 02' => 'Sigma 15mm F2.8 EX Diagonal Fisheye',
274 '26 58 31 31 14 14 1C 02' => 'Sigma 20mm F1.8 EX DG Aspherical RF',
275 '26 58 37 37 14 14 1C 02' => 'Sigma 24mm F1.8 EX DG Aspherical Macro',
276 'E1 58 37 37 14 14 1C 02' => 'Sigma 24mm F1.8 EX DG Aspherical Macro',
277 '02 46 37 37 25 25 02 00' => 'Sigma 24mm F2.8 Super Wide II Macro',
278 '26 58 3C 3C 14 14 1C 02' => 'Sigma 28mm F1.8 EX DG Aspherical Macro',
279 '48 54 3E 3E 0C 0C 4B 06' => 'Sigma 30mm F1.4 EX DC HSM',
280 'F8 54 3E 3E 0C 0C 4B 06' => 'Sigma 30mm F1.4 EX DC HSM', #JD
281 'DE 54 50 50 0C 0C 4B 06' => 'Sigma 50mm F1.4 EX DG HSM',
282 '32 54 50 50 24 24 35 02' => 'Sigma Macro 50mm F2.8 EX DG',
283 'E3 54 50 50 24 24 35 02' => 'Sigma Macro 50mm F2.8 EX DG', #http://u88.n24.queensu.ca/exiftool/forum/index.php/topic,3215.0.html
284 '79 48 5C 5C 24 24 1C 06' => 'Sigma Macro 70mm F2.8 EX DG', #JD
285 '9B 54 62 62 0C 0C 4B 06' => 'Sigma 85mm F1.4 EX DG HSM',
286 '02 48 65 65 24 24 02 00' => 'Sigma 90mm F2.8 Macro',
287 '32 54 6A 6A 24 24 35 02.2' => 'Sigma Macro 105mm F2.8 EX DG', #JD
288 'E5 54 6A 6A 24 24 35 02' => 'Sigma Macro 105mm F2.8 EX DG',
289 '48 48 76 76 24 24 4B 06' => 'Sigma 150mm F2.8 EX DG APO Macro HSM',
290 'F5 48 76 76 24 24 4B 06' => 'Sigma 150mm F2.8 EX DG APO Macro HSM', #24
291 '48 4C 7C 7C 2C 2C 4B 02' => 'Sigma 180mm F3.5 EX DG Macro',
292 '48 4C 7D 7D 2C 2C 4B 02' => 'Sigma APO Macro 180mm F3.5 EX DG HSM',
293 '48 54 8E 8E 24 24 4B 02' => 'Sigma APO 300mm F2.8 EX DG HSM',
294 'FB 54 8E 8E 24 24 4B 02' => 'Sigma APO 300mm F2.8 EX DG HSM', #26
295 '26 48 8E 8E 30 30 1C 02' => 'Sigma APO Tele Macro 300mm F4',
296 '02 2F 98 98 3D 3D 02 00' => 'Sigma APO 400mm F5.6',
297 '26 3C 98 98 3C 3C 1C 02' => 'Sigma APO Tele Macro 400mm F5.6',
298 '02 37 A0 A0 34 34 02 00' => 'Sigma APO 500mm F4.5', #19
299 '48 44 A0 A0 34 34 4B 02' => 'Sigma APO 500mm F4.5 EX HSM',
300 'F1 44 A0 A0 34 34 4B 02' => 'Sigma APO 500mm F4.5 EX DG HSM',
301 '02 34 A0 A0 44 44 02 00' => 'Sigma APO 500mm F7.2',
302 '02 3C B0 B0 3C 3C 02 00' => 'Sigma APO 800mm F5.6',
303 '48 3C B0 B0 3C 3C 4B 02' => 'Sigma APO 800mm F5.6 EX HSM',
304 '9E 38 11 29 34 3C 4B 06' => 'Sigma 8-16mm F4.5-5.6 DC HSM',
305 'A1 41 19 31 2C 2C 4B 06' => 'Sigma 10-20mm F3.5 EX DC HSM',
306 '48 3C 19 31 30 3C 4B 06' => 'Sigma 10-20mm F4-5.6 EX DC HSM',
307 'F9 3C 19 31 30 3C 4B 06' => 'Sigma 10-20mm F4-5.6 EX DC HSM', #JD
308 '48 38 1F 37 34 3C 4B 06' => 'Sigma 12-24mm F4.5-5.6 EX DG Aspherical HSM',
309 'F0 38 1F 37 34 3C 4B 06' => 'Sigma 12-24mm F4.5-5.6 EX DG Aspherical HSM',
310 '26 40 27 3F 2C 34 1C 02' => 'Sigma 15-30mm F3.5-4.5 EX DG Aspherical DF',
311 '48 48 2B 44 24 30 4B 06' => 'Sigma 17-35mm F2.8-4 EX DG Aspherical HSM',
312 '26 54 2B 44 24 30 1C 02' => 'Sigma 17-35mm F2.8-4 EX Aspherical',
313 '7A 47 2B 5C 24 34 4B 06' => 'Sigma 17-70mm F2.8-4.5 DC Macro Asp. IF HSM',
314 '7A 48 2B 5C 24 34 4B 06' => 'Sigma 17-70mm F2.8-4.5 DC Macro Asp. IF HSM',
315 '7F 48 2B 5C 24 34 1C 06' => 'Sigma 17-70mm F2.8-4.5 DC Macro Asp. IF',
316 '26 40 2D 44 2B 34 1C 02' => 'Sigma 18-35 F3.5-4.5 Aspherical',
317 '26 48 2D 50 24 24 1C 06' => 'Sigma 18-50mm F2.8 EX DC',
318 '7F 48 2D 50 24 24 1C 06' => 'Sigma 18-50mm F2.8 EX DC Macro', #25
319 '7A 48 2D 50 24 24 4B 06' => 'Sigma 18-50mm F2.8 EX DC Macro',
320 'F6 48 2D 50 24 24 4B 06' => 'Sigma 18-50mm F2.8 EX DC Macro',
321 'A4 47 2D 50 24 34 4B 0E' => 'Sigma 18-50mm F2.8-4.5 DC OS HSM',
322 '26 40 2D 50 2C 3C 1C 06' => 'Sigma 18-50mm F3.5-5.6 DC',
323 '7A 40 2D 50 2C 3C 4B 06' => 'Sigma 18-50mm F3.5-5.6 DC HSM',
324 '26 40 2D 70 2B 3C 1C 06' => 'Sigma 18-125mm F3.5-5.6 DC',
325 'CD 3D 2D 70 2E 3C 4B 0E' => 'Sigma 18-125mm F3.8-5.6 DC OS HSM',
326 '26 40 2D 80 2C 40 1C 06' => 'Sigma 18-200mm F3.5-6.3 DC',
327 '7A 40 2D 80 2C 40 4B 0E' => 'Sigma 18-200mm F3.5-6.3 DC OS HSM',
328 'ED 40 2D 80 2C 40 4B 0E' => 'Sigma 18-200mm F3.5-6.3 DC OS HSM', #JD
329 'A5 40 2D 88 2C 40 4B 0E' => 'Sigma 18-250mm F3.5-6.3 DC OS HSM',
330 '26 48 31 49 24 24 1C 02' => 'Sigma 20-40mm F2.8',
331 '26 48 37 56 24 24 1C 02' => 'Sigma 24-60mm F2.8 EX DG',
332 'B6 48 37 56 24 24 1C 02' => 'Sigma 24-60mm F2.8 EX DG',
333 'A6 48 37 5C 24 24 4B 06' => 'Sigma 24-70mm F2.8 IF EX DG HSM', #JD
334 '26 54 37 5C 24 24 1C 02' => 'Sigma 24-70mm F2.8 EX DG Macro',
335 '67 54 37 5C 24 24 1C 02' => 'Sigma 24-70mm F2.8 EX DG Macro',
336 'E9 54 37 5C 24 24 1C 02' => 'Sigma 24-70mm F2.8 EX DG Macro',
337 '26 40 37 5C 2C 3C 1C 02' => 'Sigma 24-70mm F3.5-5.6 Aspherical HF',
338 '26 54 37 73 24 34 1C 02' => 'Sigma 24-135mm F2.8-4.5',
339 '02 46 3C 5C 25 25 02 00' => 'Sigma 28-70mm F2.8',
340 '26 54 3C 5C 24 24 1C 02' => 'Sigma 28-70mm F2.8 EX',
341 '26 48 3C 5C 24 24 1C 06' => 'Sigma 28-70mm F2.8 EX DG',
342 '26 48 3C 5C 24 30 1C 02' => 'Sigma 28-70mm F2.8-4 DG',
343 '02 3F 3C 5C 2D 35 02 00' => 'Sigma 28-70mm F3.5-4.5 UC',
344 '26 40 3C 60 2C 3C 1C 02' => 'Sigma 28-80mm F3.5-5.6 Mini Zoom Macro II Aspherical',
345 '26 40 3C 65 2C 3C 1C 02' => 'Sigma 28-90mm F3.5-5.6 Macro',
346 '26 48 3C 6A 24 30 1C 02' => 'Sigma 28-105mm F2.8-4 Aspherical',
347 '26 3E 3C 6A 2E 3C 1C 02' => 'Sigma 28-105mm F3.8-5.6 UC-III Aspherical IF',
348 '26 40 3C 80 2C 3C 1C 02' => 'Sigma 28-200mm F3.5-5.6 Compact Aspherical Hyperzoom Macro',
349 '26 40 3C 80 2B 3C 1C 02' => 'Sigma 28-200mm F3.5-5.6 Compact Aspherical Hyperzoom Macro',
350 '26 3D 3C 80 2F 3D 1C 02' => 'Sigma 28-300mm F3.8-5.6 Aspherical',
351 '26 41 3C 8E 2C 40 1C 02' => 'Sigma 28-300mm F3.5-6.3 DG Macro',
352 'E6 41 3C 8E 2C 40 1C 02' => 'Sigma 28-300mm F3.5-6.3 DG Macro', #http://u88.n24.queensu.ca/exiftool/forum/index.php/topic,3301.0.html
353 '26 40 3C 8E 2C 40 1C 02' => 'Sigma 28-300mm F3.5-6.3 Macro',
354 '02 3B 44 61 30 3D 02 00' => 'Sigma 35-80mm F4-5.6',
355 '02 40 44 73 2B 36 02 00' => 'Sigma 35-135mm F3.5-4.5 a',
356 '7A 47 50 76 24 24 4B 06' => 'Sigma 50-150mm F2.8 EX APO DC HSM',
357 'FD 47 50 76 24 24 4B 06' => 'Sigma 50-150mm F2.8 EX APO DC HSM II',
358 '48 3C 50 A0 30 40 4B 02' => 'Sigma 50-500mm F4-6.3 EX APO RF HSM',
359 '9F 37 50 A0 34 40 4B 0E' => 'Sigma 50-500mm F4.5-6.3 DG OS HSM', #16
360 '26 3C 54 80 30 3C 1C 06' => 'Sigma 55-200mm F4-5.6 DC',
361 '7A 3B 53 80 30 3C 4B 06' => 'Sigma 55-200mm F4-5.6 DC HSM',
362 '48 54 5C 80 24 24 4B 02' => 'Sigma 70-200mm F2.8 EX APO IF HSM',
363 '7A 48 5C 80 24 24 4B 06' => 'Sigma 70-200mm F2.8 EX APO DG Macro HSM II',
364 'EE 48 5C 80 24 24 4B 06' => 'Sigma 70-200mm F2.8 EX APO DG Macro HSM II', #JD
365 '9C 48 5C 80 24 24 4B 0E' => 'Sigma 70-200mm F2.8 EX DG OS HSM', #Rolando Ruzic
366 '02 46 5C 82 25 25 02 00' => 'Sigma 70-210mm F2.8 APO', #JD
367 '26 3C 5C 82 30 3C 1C 02' => 'Sigma 70-210mm F4-5.6 UC-II',
368 '26 3C 5C 8E 30 3C 1C 02' => 'Sigma 70-300mm F4-5.6 DG Macro',
369 '56 3C 5C 8E 30 3C 1C 02' => 'Sigma 70-300mm F4-5.6 APO Macro Super II',
370 'E0 3C 5C 8E 30 3C 4B 06' => 'Sigma 70-300mm F4-5.6 APO DG Macro HSM', #22
371 'A3 3C 5C 8E 30 3C 4B 0E' => 'Sigma 70-300mm F4-5.6 DG OS',
372 '02 37 5E 8E 35 3D 02 00' => 'Sigma 75-300mm F4.5-5.6 APO',
373 '02 3A 5E 8E 32 3D 02 00' => 'Sigma 75-300mm F4.0-5.6',
374 '77 44 61 98 34 3C 7B 0E' => 'Sigma 80-400mm F4.5-5.6 EX OS',
375 '48 48 68 8E 30 30 4B 02' => 'Sigma 100-300mm F4 EX IF HSM',
376 'F3 48 68 8E 30 30 4B 02' => 'Sigma APO 100-300mm F4 EX IF HSM',
377 '48 54 6F 8E 24 24 4B 02' => 'Sigma APO 120-300mm F2.8 EX DG HSM',
378 '7A 54 6E 8E 24 24 4B 02' => 'Sigma APO 120-300mm F2.8 EX DG HSM',
379 'FA 54 6E 8E 24 24 4B 02' => 'Sigma APO 120-300mm F2.8 EX DG HSM', #http://u88.n24.queensu.ca/exiftool/forum/index.php/topic,2787.0.html
380 'CF 38 6E 98 34 3C 4B 0E' => 'Sigma APO 120-400mm F4.5-5.6 DG OS HSM',
381 '26 44 73 98 34 3C 1C 02' => 'Sigma 135-400mm F4.5-5.6 APO Aspherical',
382 'CE 34 76 A0 38 40 4B 0E' => 'Sigma 150-500mm F5-6.3 DG OS APO HSM', #JD
383 '26 40 7B A0 34 40 1C 02' => 'Sigma APO 170-500mm F5-6.3 Aspherical RF',
384 'A7 49 80 A0 24 24 4B 06' => 'Sigma APO 200-500mm F2.8 EX DG',
385 '48 3C 8E B0 3C 3C 4B 02' => 'Sigma APO 300-800mm F5.6 EX DG HSM',
386#
387 '00 47 25 25 24 24 00 02' => 'Tamron SP AF 14mm f/2.8 Aspherical (IF) (69E)',
388 'F4 54 56 56 18 18 84 06' => 'Tamron SP AF 60mm f/2.0 Di II Macro 1:1 (G005)', #24
389 '1E 5D 64 64 20 20 13 00' => 'Tamron SP AF 90mm f/2.5 (52E)',
390 '20 5A 64 64 20 20 14 00' => 'Tamron SP AF 90mm f/2.5 Macro (152E)',
391 '22 53 64 64 24 24 E0 02' => 'Tamron SP AF 90mm f/2.8 Macro 1:1 (72E)',
392 '32 53 64 64 24 24 35 02' => 'Tamron SP AF 90mm f/2.8 [Di] Macro 1:1 (172E/272E)',
393 'F8 55 64 64 24 24 84 06' => 'Tamron SP AF 90mm f/2.8 Di Macro 1:1 (272NII)',
394 'F8 54 64 64 24 24 DF 06' => 'Tamron SP AF 90mm f/2.8 Di Macro 1:1 (272NII)',
395 '00 4C 7C 7C 2C 2C 00 02' => 'Tamron SP AF 180mm f/3.5 Di Model (B01)',
396 '21 56 8E 8E 24 24 14 00' => 'Tamron SP AF 300mm f/2.8 LD-IF (60E)',
397 '27 54 8E 8E 24 24 1D 02' => 'Tamron SP AF 300mm f/2.8 LD-IF (360E)',
398 'F6 3F 18 37 2C 34 84 06' => 'Tamron SP AF 10-24mm f/3.5-4.5 Di II LD Aspherical (IF) (B001)',
399 '00 36 1C 2D 34 3C 00 06' => 'Tamron SP AF 11-18mm f/4.5-5.6 Di II LD Aspherical (IF) (A13)',
400 '07 46 2B 44 24 30 03 02' => 'Tamron SP AF 17-35mm f/2.8-4 Di LD Aspherical (IF) (A05)',
401 '00 53 2B 50 24 24 00 06' => 'Tamron SP AF 17-50mm f/2.8 XR Di II LD Aspherical (IF) (A16)', #PH
402 '00 54 2B 50 24 24 00 06' => 'Tamron SP AF 17-50mm f/2.8 XR Di II LD Aspherical (IF) (A16NII)',
403 'F3 54 2B 50 24 24 84 0E' => 'Tamron SP AF 17-50mm f/2.8 XR Di II VC LD Aspherical (IF) (B005)',
404 '00 3F 2D 80 2B 40 00 06' => 'Tamron AF 18-200mm f/3.5-6.3 XR Di II LD Aspherical (IF) (A14)',
405 '00 3F 2D 80 2C 40 00 06' => 'Tamron AF 18-200mm f/3.5-6.3 XR Di II LD Aspherical (IF) Macro (A14)',
406 '00 40 2D 80 2C 40 00 06' => 'Tamron AF 18-200mm f/3.5-6.3 XR Di II LD Aspherical (IF) Macro (A14NII)', #25
407 '00 40 2D 88 2C 40 62 06' => 'Tamron AF 18-250mm f/3.5-6.3 Di II LD Aspherical (IF) Macro (A18)',
408 '00 40 2D 88 2C 40 00 06' => 'Tamron AF 18-250mm f/3.5-6.3 Di II LD Aspherical (IF) Macro (A18NII)', #JD
409 'F5 40 2C 8A 2C 40 40 0E' => 'Tamron AF 18-270mm f/3.5-6.3 Di II VC LD Aspherical (IF) Macro (B003)',
410 '07 40 2F 44 2C 34 03 02' => 'Tamron AF 19-35mm f/3.5-4.5 (A10)',
411 '07 40 30 45 2D 35 03 02' => 'Tamron AF 19-35mm f/3.5-4.5 (A10)',
412 '00 49 30 48 22 2B 00 02' => 'Tamron SP AF 20-40mm f/2.7-3.5 (166D)',
413 '0E 4A 31 48 23 2D 0E 02' => 'Tamron SP AF 20-40mm f/2.7-3.5 (166D)',
414 '45 41 37 72 2C 3C 48 02' => 'Tamron SP AF 24-135mm f/3.5-5.6 AD Aspherical (IF) Macro (190D)',
415 '33 54 3C 5E 24 24 62 02' => 'Tamron SP AF 28-75mm f/2.8 XR Di LD Aspherical (IF) Macro (A09)',
416 'FA 54 3C 5E 24 24 84 06' => 'Tamron SP AF 28-75mm f/2.8 XR Di LD Aspherical (IF) Macro (A09NII)', #JD
417 '10 3D 3C 60 2C 3C D2 02' => 'Tamron AF 28-80mm f/3.5-5.6 Aspherical (177D)',
418 '45 3D 3C 60 2C 3C 48 02' => 'Tamron AF 28-80mm f/3.5-5.6 Aspherical (177D)',
419 '00 48 3C 6A 24 24 00 02' => 'Tamron SP AF 28-105mm f/2.8 LD Aspherical IF (176D)',
420 '0B 3E 3D 7F 2F 3D 0E 00' => 'Tamron AF 28-200mm f/3.8-5.6 (71D)',
421 '0B 3E 3D 7F 2F 3D 0E 02' => 'Tamron AF 28-200mm f/3.8-5.6D (171D)',
422 '12 3D 3C 80 2E 3C DF 02' => 'Tamron AF 28-200mm f/3.8-5.6 AF Aspherical LD (IF) (271D)',
423 '4D 41 3C 8E 2B 40 62 02' => 'Tamron AF 28-300mm f/3.5-6.3 XR Di LD Aspherical (IF) (A061)',
424 '4D 41 3C 8E 2C 40 62 02' => 'Tamron AF 28-300mm f/3.5-6.3 XR LD Aspherical (IF) (185D)',
425 'F9 40 3C 8E 2C 40 40 0E' => 'Tamron AF 28-300mm f/3.5-6.3 XR Di VC LD Aspherical (IF) Macro (A20)',
426 '00 47 53 80 30 3C 00 06' => 'Tamron AF 55-200mm f/4-5.6 Di II LD (A15)',
427 'F7 53 5C 80 24 24 84 06' => 'Tamron SP AF 70-200mm f/2.8 Di LD (IF) Macro (A001)',
428 'FE 53 5C 80 24 24 84 06' => 'Tamron SP AF 70-200mm f/2.8 Di LD (IF) Macro (A001)',
429 '69 48 5C 8E 30 3C 6F 02' => 'Tamron AF 70-300mm f/4-5.6 LD Macro 1:2 (772D)',
430 '69 47 5C 8E 30 3C 00 02' => 'Tamron AF 70-300mm f/4-5.6 Di LD Macro 1:2 (A17N)',
431 '00 48 5C 8E 30 3C 00 06' => 'Tamron AF 70-300mm f/4-5.6 Di LD Macro 1:2 (A17)', #JD
432 'F1 47 5C 8E 30 3C DF 0E' => 'Tamron SP 70-300mm f/4-5.6 Di VC USD (A005)',
433 '20 3C 80 98 3D 3D 1E 02' => 'Tamron AF 200-400mm f/5.6 LD IF (75D)',
434 '00 3E 80 A0 38 3F 00 02' => 'Tamron SP AF 200-500mm f/5-6.3 Di LD (IF) (A08)',
435 '00 3F 80 A0 38 3F 00 02' => 'Tamron SP AF 200-500mm f/5-6.3 Di (A08)',
436#
437 '00 40 2B 2B 2C 2C 00 02' => 'Tokina AT-X 17 AF PRO (AF 17mm f/3.5)',
438 '00 47 44 44 24 24 00 06' => 'Tokina AT-X M35 PRO DX (AF 35mm f/2.8 Macro)',
439 '00 54 68 68 24 24 00 02' => 'Tokina AT-X M100 PRO D (AF 100mm f/2.8 Macro)',
440 '27 48 8E 8E 30 30 1D 02' => 'Tokina AT-X 304 AF (AF 300mm f/4.0)',
441 '00 54 8E 8E 24 24 00 02' => 'Tokina AT-X 300 AF PRO (AF 300mm f/2.8)',
442 '12 3B 98 98 3D 3D 09 00' => 'Tokina AT-X 400 AF SD (AF 400mm f/5.6)',
443 '00 40 18 2B 2C 34 00 06' => 'Tokina AT-X 107 DX Fisheye (AF 10-17mm f/3.5-4.5)',
444 '00 48 1C 29 24 24 00 06' => 'Tokina AT-X 116 PRO DX (AF 11-16mm f/2.8)',
445 '00 3C 1F 37 30 30 00 06' => 'Tokina AT-X 124 AF PRO DX (AF 12-24mm f/4)',
446 '7A 3C 1F 37 30 30 7E 06.2' => 'Tokina AT-X 124 AF PRO DX II (AF 12-24mm f/4)',
447 '00 48 29 3C 24 24 00 06' => 'Tokina AT-X 16-28 AF PRO FX (AF 16-28mm f/2.8)',
448 '00 48 29 50 24 24 00 06' => 'Tokina AT-X 165 PRO DX (AF 16-50mm f/2.8)',
449 '00 40 2A 72 2C 3C 00 06' => 'Tokina AT-X 16.5-135 DX (AF 16.5-135mm F3.5-5.6)',
450 '2F 40 30 44 2C 34 29 02.2' => 'Tokina AF 193 (AF 19-35mm f/3.5-4.5)',
451 '2F 48 30 44 24 24 29 02.2' => 'Tokina AT-X 235 AF PRO (AF 20-35mm f/2.8)',
452 '2F 40 30 44 2C 34 29 02.1' => 'Tokina AF 235 II (AF 20-35mm f/3.5-4.5)',
453 '00 40 37 80 2C 3C 00 02' => 'Tokina AT-X 242 AF (AF 24-200mm f/3.5-5.6)',
454 '25 48 3C 5C 24 24 1B 02.1' => 'Tokina AT-X 270 AF PRO II (AF 28-70mm f/2.6-2.8)',
455 '25 48 3C 5C 24 24 1B 02.2' => 'Tokina AT-X 287 AF PRO SV (AF 28-70mm f/2.8)',
456 '07 48 3C 5C 24 24 03 00' => 'Tokina AT-X 287 AF (AF 28-70mm f/2.8)',
457 '07 47 3C 5C 25 35 03 00' => 'Tokina AF 287 SD (AF 28-70mm f/2.8-4.5)',
458 '07 40 3C 5C 2C 35 03 00' => 'Tokina AF 270 II (AF 28-70mm f/3.5-4.5)',
459 '00 48 3C 60 24 24 00 02' => 'Tokina AT-X 280 AF PRO (AF 28-80mm f/2.8)',
460 '25 44 44 8E 34 42 1B 02' => 'Tokina AF 353 (AF 35-300mm f/4.5-6.7)',
461 '00 48 50 72 24 24 00 06' => 'Tokina AT-X 535 PRO DX (AF 50-135mm f/2.8)',
462 '12 44 5E 8E 34 3C 09 00' => 'Tokina AF 730 (AF 75-300mm F4.5-5.6)',
463 '14 54 60 80 24 24 0B 00' => 'Tokina AT-X 828 AF (AF 80-200mm f/2.8)',
464 '24 54 60 80 24 24 1A 02' => 'Tokina AT-X 828 AF PRO (AF 80-200mm f/2.8)',
465 '24 44 60 98 34 3C 1A 02' => 'Tokina AT-X 840 AF-II (AF 80-400mm f/4.5-5.6)',
466 '00 44 60 98 34 3C 00 02' => 'Tokina AT-X 840 D (AF 80-400mm f/4.5-5.6)',
467 '14 48 68 8E 30 30 0B 00' => 'Tokina AT-X 340 AF (AF 100-300mm f/4)',
468#
469 '06 3F 68 68 2C 2C 06 00' => 'Cosina AF 100mm F3.5 Macro',
470 '07 36 3D 5F 2C 3C 03 00' => 'Cosina AF Zoom 28-80mm F3.5-5.6 MC Macro',
471 '07 46 3D 6A 25 2F 03 00' => 'Cosina AF Zoom 28-105mm F2.8-3.8 MC',
472 '12 36 5C 81 35 3D 09 00' => 'Cosina AF Zoom 70-210mm F4.5-5.6 MC Macro',
473 '12 39 5C 8E 34 3D 08 02' => 'Cosina AF Zoom 70-300mm F4.5-5.6 MC Macro',
474 '12 3B 68 8D 3D 43 09 02' => 'Cosina AF Zoom 100-300mm F5.6-6.7 MC Macro',
475#
476 '00 40 31 31 2C 2C 00 00' => 'Voigtlander Color Skopar 20mm F3.5 SLII Aspherical',
477 '00 54 48 48 18 18 00 00' => 'Voigtlander Ultron 40mm F2 SLII Aspherical',
478 '00 54 55 55 0C 0C 00 00' => 'Voigtlander Nokton 58mm F1.4 SLII',
479 '00 40 64 64 2C 2C 00 00' => 'Voigtlander APO-Lanthar 90mm F3.5 SLII Close Focus',
480#
481 '00 40 2D 2D 2C 2C 00 00' => 'Carl Zeiss Distagon T* 3,5/18 ZF.2',
482 '00 48 32 32 24 24 00 00' => 'Carl Zeiss Distagon T* 2,8/21 ZF.2',
483 '00 54 3C 3C 18 18 00 00' => 'Carl Zeiss Distagon T* 2/28 ZF.2',
484 '00 54 44 44 18 18 00 00' => 'Carl Zeiss Distagon T* 2/35 ZF.2',
485 '00 54 50 50 0C 0C 00 00' => 'Carl Zeiss Planar T* 1,4/50 ZF.2',
486 '00 54 50 50 18 18 00 00' => 'Carl Zeiss Makro-Planar T* 2/50 ZF.2',
487 '00 54 62 62 0C 0C 00 00' => 'Carl Zeiss Planar T* 1,4/85 ZF.2',
488 '00 54 68 68 18 18 00 00' => 'Carl Zeiss Makro-Planar T* 2/100 ZF.2',
489#
490 '00 54 56 56 30 30 00 00' => 'Coastal Optical Systems 60mm 1:4 UV-VIS-IR Macro Apo',
491#
492 '4A 48 24 24 24 0C 4D 02' => 'Samyang AE 14mm f/2.8 ED AS IF UMC', #http://u88.n24.queensu.ca/exiftool/forum/index.php/topic,3150.0.html
493 '4A 60 44 44 0C 0C 4D 02' => 'Samyang 35mm f/1.4 AS UMC',
494 '4A 60 62 62 0C 0C 4D 02' => 'Samyang AE 85mm f/1.4 AS IF UMC', #http://u88.n24.queensu.ca/exiftool/forum/index.php/topic,2888.0.html
495#
496 '02 40 44 5C 2C 34 02 00' => 'Exakta AF 35-70mm 1:3.5-4.5 MC',
497#
498 '07 3E 30 43 2D 35 03 00' => 'Soligor AF Zoom 19-35mm 1:3.5-4.5 MC',
499 '03 43 5C 81 35 35 02 00' => 'Soligor AF C/D Zoom UMCS 70-210mm 1:4.5',
500 '12 4A 5C 81 31 3D 09 00' => 'Soligor AF C/D Auto Zoom+Macro 70-210mm 1:4-5.6 UMCS',
501#
502 '00 00 00 00 00 00 00 01' => 'Manual Lens No CPU',
503#
504 '00 47 10 10 24 24 00 00' => 'Fisheye Nikkor 8mm f/2.8 AiS',
505 '00 54 44 44 0C 0C 00 00' => 'Nikkor 35mm f/1.4 AiS',
506 '00 48 50 50 18 18 00 00' => 'Nikkor H 50mm f/2',
507 '00 58 64 64 20 20 00 00' => 'Soligor C/D Macro MC 90mm f/2.5',
508 '00 48 68 68 24 24 00 00' => 'Series E 100mm f/2.8',
509 '00 4C 6A 6A 20 20 00 00' => 'Nikkor 105mm f/2.5 AiS',
510 '00 48 80 80 30 30 00 00' => 'Nikkor 200mm f/4 AiS',
511);
512
513# flash firmware decoding (ref JD)
514my %flashFirmware = (
515 '0 0' => 'n/a',
516 '1 1' => '1.01 (SB-800 or Metz 58 AF-1)',
517 '1 3' => '1.03 (SB-800)',
518 '2 1' => '2.01 (SB-800)',
519 '2 4' => '2.04 (SB-600)',
520 '2 5' => '2.05 (SB-600)',
521 '3 1' => '3.01 (SU-800 Remote Commander)',
522 '4 1' => '4.01 (SB-400)',
523 '4 2' => '4.02 (SB-400)',
524 '4 4' => '4.04 (SB-400)',
525 '5 1' => '5.01 (SB-900)',
526 '5 2' => '5.02 (SB-900)',
527 OTHER => sub {
528 my ($val, $inv) = @_;
529 return sprintf('%d.%.2d (Unknown model)', split(' ', $val)) unless $inv;
530 return "$1 $2" if $val =~ /(\d+)\.(\d+)/;
531 return '0 0';
532 },
533);
534
535# flash Guide Number (GN) distance settings (ref 28)
536my %flashGNDistance = (
537 0 => 0, 19 => '2.8 m',
538 1 => '0.1 m', 20 => '3.2 m',
539 2 => '0.2 m', 21 => '3.6 m',
540 3 => '0.3 m', 22 => '4.0 m',
541 4 => '0.4 m', 23 => '4.5 m',
542 5 => '0.5 m', 24 => '5.0 m',
543 6 => '0.6 m', 25 => '5.6 m',
544 7 => '0.7 m', 26 => '6.3 m',
545 8 => '0.8 m', 27 => '7.1 m',
546 9 => '0.9 m', 28 => '8.0 m',
547 10 => '1.0 m', 29 => '9.0 m',
548 11 => '1.1 m', 30 => '10.0 m',
549 12 => '1.3 m', 31 => '11.0 m',
550 13 => '1.4 m', 32 => '13.0 m',
551 14 => '1.6 m', 33 => '14.0 m',
552 15 => '1.8 m', 34 => '16.0 m',
553 16 => '2.0 m', 35 => '18.0 m',
554 17 => '2.2 m', 36 => '20.0 m',
555 18 => '2.5 m', 255 => 'n/a',
556);
557
558# flash control mode values (ref JD)
559my %flashControlMode = (
560 0x00 => 'Off',
561 0x01 => 'iTTL-BL',
562 0x02 => 'iTTL',
563 0x03 => 'Auto Aperture',
564 0x04 => 'Automatic', #28
565 0x05 => 'GN (distance priority)', #28 (Guide Number, but called "GN" in manual)
566 0x06 => 'Manual',
567 0x07 => 'Repeating Flash',
568);
569
570my %retouchValues = ( #PH
571 0 => 'None',
572 3 => 'B & W',
573 4 => 'Sepia',
574 5 => 'Trim',
575 6 => 'Small Picture',
576 7 => 'D-Lighting',
577 8 => 'Red Eye',
578 9 => 'Cyanotype',
579 10 => 'Sky Light',
580 11 => 'Warm Tone',
581 12 => 'Color Custom',
582 13 => 'Image Overlay',
583 14 => 'Red Intensifier',
584 15 => 'Green Intensifier',
585 16 => 'Blue Intensifier',
586 17 => 'Cross Screen',
587 18 => 'Quick Retouch',
588 19 => 'NEF Processing',
589 23 => 'Distortion Control',
590 25 => 'Fisheye',
591 26 => 'Straighten',
592 29 => 'Perspective Control',
593 30 => 'Color Outline',
594 31 => 'Soft Filter',
595 33 => 'Miniature Effect',
596);
597
598my %offOn = ( 0 => 'Off', 1 => 'On' );
599
600# common attributes for writable BinaryData directories
601my %binaryDataAttrs = (
602 PROCESS_PROC => \&Image::ExifTool::ProcessBinaryData,
603 WRITE_PROC => \&Image::ExifTool::WriteBinaryData,
604 CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
605 WRITABLE => 1,
606 FIRST_ENTRY => 0,
607);
608
609# Nikon maker note tags
610%Image::ExifTool::Nikon::Main = (
611 PROCESS_PROC => \&Image::ExifTool::Nikon::ProcessNikon,
612 WRITE_PROC => \&Image::ExifTool::Nikon::ProcessNikon,
613 CHECK_PROC => \&Image::ExifTool::Exif::CheckExif,
614 WRITABLE => 1,
615 GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
616 PRINT_CONV => \&FormatString,
617 0x0001 => { #2
618 # the format differs for different models. for D70, this is a string '0210',
619 # but for the E775 it is binary: "\x00\x01\x00\x00"
620 Name => 'MakerNoteVersion',
621 Writable => 'undef',
622 Count => 4,
623 # convert to string if binary
624 ValueConv => '$_=$val; /^[\x00-\x09]/ and $_=join("",unpack("CCCC",$_)); $_',
625 ValueConvInv => '$val',
626 PrintConv => '$_=$val;s/^(\d{2})/$1\./;s/^0//;$_',
627 PrintConvInv => '$_=$val;s/\.//;"0$_"',
628 },
629 0x0002 => {
630 # this is the ISO actually used by the camera
631 # (may be different than ISO setting if auto)
632 Name => 'ISO',
633 Writable => 'int16u',
634 Count => 2,
635 Priority => 0, # the EXIF ISO is more reliable
636 Groups => { 2 => 'Image' },
637 # D300 sets this to undef with 4 zero bytes when LO ISO is used - PH
638 RawConv => '$val eq "\0\0\0\0" ? undef : $val',
639 # first number is 1 for "Hi ISO" modes (H0.3, H0.7 and H1.0 on D80) - PH
640 PrintConv => '$_=$val;s/^0 //;s/^1 (\d+)/Hi $1/;$_',
641 PrintConvInv => '$_=$val;/^\d+/ ? "0 $_" : (s/Hi ?//i ? "1 $_" : $_)',
642 },
643 # Note: we attempt to fix the case of these string values (typically written in all caps)
644 0x0003 => { Name => 'ColorMode', Writable => 'string' },
645 0x0004 => { Name => 'Quality', Writable => 'string' },
646 0x0005 => { Name => 'WhiteBalance', Writable => 'string' },
647 0x0006 => { Name => 'Sharpness', Writable => 'string' },
648 0x0007 => { Name => 'FocusMode', Writable => 'string' },
649 # FlashSetting (better named FlashSyncMode, ref 28) values:
650 # "Normal", "Slow", "Rear Slow", "RED-EYE", "RED-EYE SLOW"
651 0x0008 => { Name => 'FlashSetting', Writable => 'string' },
652 # FlashType observed values:
653 # internal: "Built-in,TTL", "Built-in,RPT", "Comdr.", "NEW_TTL"
654 # external: "Optional,TTL", "Optional,RPT", "Optional,M", "Comdr."
655 # both: "Built-in,TTL&Comdr."
656 # no flash: ""
657 0x0009 => { Name => 'FlashType', Writable => 'string' }, #2 (count varies by model - PH)
658 # 0x000a - rational values: 5.6 to 9.283 - found in coolpix models - PH
659 # (not correlated with any LV or scale factor)
660 0x000b => { #2
661 Name => 'WhiteBalanceFineTune',
662 Writable => 'int16s',
663 Count => -1, # older models write 1 value, newer DSLR's write 2 - PH
664 },
665 0x000c => { # (D1X)
666 Name => 'WB_RBLevels',
667 Writable => 'rational64u',
668 Count => 4, # (not sure what the last 2 values are for)
669 },
670 0x000d => { #15
671 Name => 'ProgramShift',
672 Writable => 'undef',
673 Count => 4,
674 ValueConv => 'my ($a,$b,$c)=unpack("c3",$val); $c ? $a*($b/$c) : 0',
675 ValueConvInv => q{
676 my $a = int($val*6 + ($val>0 ? 0.5 : -0.5));
677 $a<-128 or $a>127 ? undef : pack("c4",$a,1,6,0);
678 },
679 PrintConv => 'Image::ExifTool::Exif::PrintFraction($val)',
680 PrintConvInv => 'Image::ExifTool::Exif::ConvertFraction($val)',
681 },
682 0x000e => {
683 Name => 'ExposureDifference',
684 Writable => 'undef',
685 Count => 4,
686 ValueConv => 'my ($a,$b,$c)=unpack("c3",$val); $c ? $a*($b/$c) : 0',
687 ValueConvInv => q{
688 my $a = int($val*12 + ($val>0 ? 0.5 : -0.5));
689 $a<-128 or $a>127 ? undef : pack("c4",$a,1,12,0);
690 },
691 PrintConv => '$val ? sprintf("%+.1f",$val) : 0',
692 PrintConvInv => '$val',
693 },
694 0x000f => { Name => 'ISOSelection', Writable => 'string' }, #2
695 0x0010 => {
696 Name => 'DataDump',
697 Writable => 0,
698 Binary => 1,
699 },
700 0x0011 => {
701 Name => 'PreviewIFD',
702 Groups => { 1 => 'PreviewIFD', 2 => 'Image' },
703 Flags => 'SubIFD',
704 SubDirectory => {
705 TagTable => 'Image::ExifTool::Nikon::PreviewIFD',
706 Start => '$val',
707 },
708 },
709 0x0012 => { #2 (camera setting: combination of command dial and menus - PH)
710 Name => 'FlashExposureComp',
711 Description => 'Flash Exposure Compensation',
712 Writable => 'undef',
713 Count => 4,
714 Notes => 'may be set even if flash does not fire',
715 ValueConv => 'my ($a,$b,$c)=unpack("c3",$val); $c ? $a*($b/$c) : 0',
716 ValueConvInv => q{
717 my $a = int($val*6 + ($val>0 ? 0.5 : -0.5));
718 $a<-128 or $a>127 ? undef : pack("c4",$a,1,6,0);
719 },
720 PrintConv => 'Image::ExifTool::Exif::PrintFraction($val)',
721 PrintConvInv => 'Image::ExifTool::Exif::ConvertFraction($val)',
722 },
723 # D70 - another ISO tag
724 0x0013 => { #2
725 Name => 'ISOSetting',
726 Writable => 'int16u',
727 Count => 2,
728 PrintConv => '$_=$val;s/^0 //;$_',
729 PrintConvInv => '"0 $val"',
730 },
731 0x0014 => [
732 { #4
733 Name => 'ColorBalanceA',
734 Condition => '$format eq "undef" and $count == 2560',
735 SubDirectory => {
736 TagTable => 'Image::ExifTool::Nikon::ColorBalanceA',
737 ByteOrder => 'BigEndian',
738 },
739 },
740 { #PH
741 Name => 'NRWData',
742 Condition => '$$valPt =~ /^NRW/', # starts with "NRW 0100"
743 Notes => 'large unknown block in NRW images, not copied to JPEG images',
744 # 'Drop' because not found in JPEG images (too large for APP1 anyway)
745 Flags => [ 'Unknown', 'Binary', 'Drop' ],
746 },
747 ],
748 # D70 Image boundary?? top x,y bot-right x,y
749 0x0016 => { #2
750 Name => 'ImageBoundary',
751 Writable => 'int16u',
752 Count => 4,
753 },
754 0x0017 => { #28
755 Name => 'ExternalFlashExposureComp', #PH (setting from external flash unit)
756 Writable => 'undef',
757 Count => 4,
758 ValueConv => 'my ($a,$b,$c)=unpack("c3",$val); $c ? $a*($b/$c) : 0',
759 ValueConvInv => q{
760 my $a = int($val*6 + ($val>0 ? 0.5 : -0.5));
761 $a<-128 or $a>127 ? undef : pack("c4",$a,1,6,0);
762 },
763 PrintConv => 'Image::ExifTool::Exif::PrintFraction($val)',
764 PrintConvInv => 'Image::ExifTool::Exif::ConvertFraction($val)',
765 },
766 0x0018 => { #5
767 Name => 'FlashExposureBracketValue',
768 Writable => 'undef',
769 Count => 4,
770 ValueConv => 'my ($a,$b,$c)=unpack("c3",$val); $c ? $a*($b/$c) : 0',
771 ValueConvInv => q{
772 my $a = int($val*6 + ($val>0 ? 0.5 : -0.5));
773 $a<-128 or $a>127 ? undef : pack("c4",$a,1,6,0);
774 },
775 PrintConv => 'sprintf("%.1f",$val)',
776 PrintConvInv => '$val',
777 },
778 0x0019 => { #5
779 Name => 'ExposureBracketValue',
780 Writable => 'rational64s',
781 PrintConv => 'Image::ExifTool::Exif::PrintFraction($val)',
782 PrintConvInv => 'Image::ExifTool::Exif::ConvertFraction($val)',
783 },
784 0x001a => { #PH
785 Name => 'ImageProcessing',
786 Writable => 'string',
787 },
788 0x001b => { #15
789 Name => 'CropHiSpeed',
790 Writable => 'int16u',
791 Count => 7,
792 PrintConv => q{
793 my @a = split ' ', $val;
794 return "Unknown ($val)" unless @a == 7;
795 $a[0] = $a[0] ? "On" : "Off";
796 return "$a[0] ($a[1]x$a[2] cropped to $a[3]x$a[4] at pixel $a[5],$a[6])";
797 }
798 },
799 0x001c => { #28 (D3 "the application of CSb6 to the selected metering mode")
800 Name => 'ExposureTuning',
801 Writable => 'undef',
802 Count => 3,
803 ValueConv => 'my ($a,$b,$c)=unpack("c3",$val); $c ? $a*($b/$c) : 0',
804 ValueConvInv => q{
805 my $a = int($val*6 + ($val>0 ? 0.5 : -0.5));
806 $a<-128 or $a>127 ? undef : pack("c3",$a,1,6);
807 },
808 PrintConv => 'Image::ExifTool::Exif::PrintFraction($val)',
809 PrintConvInv => 'Image::ExifTool::Exif::ConvertFraction($val)',
810 },
811 0x001d => { #4
812 Name => 'SerialNumber',
813 Writable => 'string',
814 Protected => 1,
815 Notes => q{
816 this value is used as a key to decrypt other information -- writing this tag
817 causes the other information to be re-encrypted with the new key
818 },
819 PrintConv => undef, # disable default PRINT_CONV
820 },
821 0x001e => { #14
822 Name => 'ColorSpace',
823 Writable => 'int16u',
824 PrintConv => {
825 1 => 'sRGB',
826 2 => 'Adobe RGB',
827 },
828 },
829 0x001f => { #PH
830 Name => 'VRInfo',
831 SubDirectory => { TagTable => 'Image::ExifTool::Nikon::VRInfo' },
832 },
833 0x0020 => { #16
834 Name => 'ImageAuthentication',
835 Writable => 'int8u',
836 PrintConv => \%offOn,
837 },
838 0x0021 => { #PH
839 Name => 'FaceDetect',
840 SubDirectory => { TagTable => 'Image::ExifTool::Nikon::FaceDetect' },
841 },
842 0x0022 => { #21
843 Name => 'ActiveD-Lighting',
844 Writable => 'int16u',
845 PrintConv => {
846 0 => 'Off',
847 1 => 'Low',
848 3 => 'Normal',
849 5 => 'High',
850 7 => 'Extra High', #10
851 0xffff => 'Auto', #10
852 },
853 },
854 0x0023 => { #PH (D300, but also found in D3,D3S,D3X,D90,D300S,D700,D3000,D5000)
855 Name => 'PictureControlData',
856 Writable => 'undef',
857 Permanent => 0,
858 Binary => 1,
859 SubDirectory => { TagTable => 'Image::ExifTool::Nikon::PictureControl' },
860 },
861 0x0024 => { #JD
862 Name => 'WorldTime',
863 SubDirectory => {
864 TagTable => 'Image::ExifTool::Nikon::WorldTime',
865 # (CaptureNX does flip the byte order of this record)
866 },
867 },
868 0x0025 => { #PH
869 Name => 'ISOInfo',
870 SubDirectory => {
871 TagTable => 'Image::ExifTool::Nikon::ISOInfo',
872 ByteOrder => 'BigEndian', #(NC)
873 },
874 },
875 0x002a => { #23 (this tag added with D3 firmware 1.10 -- also written by Nikon utilities)
876 Name => 'VignetteControl',
877 Writable => 'int16u',
878 PrintConv => {
879 0 => 'Off',
880 1 => 'Low',
881 3 => 'Normal',
882 5 => 'High',
883 },
884 },
885 0x002b => { #PH
886 Name => 'DistortInfo',
887 SubDirectory => {
888 TagTable => 'Image::ExifTool::Nikon::DistortInfo',
889 ByteOrder => 'BigEndian', #(NC)
890 },
891 },
892 0x002c => { #29 (D7000)
893 Name => 'UnknownInfo',
894 SubDirectory => {
895 TagTable => 'Image::ExifTool::Nikon::UnknownInfo',
896 ByteOrder => 'BigEndian', #(NC)
897 },
898 },
899 0x0032 => { #PH
900 Name => 'UnknownInfo2',
901 SubDirectory => {
902 TagTable => 'Image::ExifTool::Nikon::UnknownInfo2',
903 ByteOrder => 'BigEndian', #(NC)
904 },
905 },
906 0x0080 => { Name => 'ImageAdjustment', Writable => 'string' },
907 0x0081 => { Name => 'ToneComp', Writable => 'string' }, #2
908 0x0082 => { Name => 'AuxiliaryLens', Writable => 'string' },
909 0x0083 => {
910 Name => 'LensType',
911 Writable => 'int8u',
912 # credit to Tom Christiansen (ref 7) for figuring this out...
913 PrintConv => q[$_ = $val ? Image::ExifTool::DecodeBits($val,
914 {
915 0 => 'MF',
916 1 => 'D',
917 2 => 'G',
918 3 => 'VR',
919 }) : 'AF';
920 # remove commas and change "D G" to just "G"
921 s/,//g; s/\bD G\b/G/; $_
922 ],
923 PrintConvInv => q[
924 my $bits = 0;
925 $bits |= 0x01 if $val =~ /\bMF\b/i;
926 $bits |= 0x02 if $val =~ /\bD\b/i;
927 $bits |= 0x06 if $val =~ /\bG\b/i;
928 $bits |= 0x08 if $val =~ /\bVR\b/i;
929 return $bits;
930 ],
931 },
932 0x0084 => { #2
933 Name => "Lens",
934 Writable => 'rational64u',
935 Count => 4,
936 # short focal, long focal, aperture at short focal, aperture at long focal
937 PrintConv => \&Image::ExifTool::Exif::PrintLensInfo,
938 PrintConvInv => \&Image::ExifTool::Exif::ConvertLensInfo,
939 },
940 0x0085 => {
941 Name => 'ManualFocusDistance',
942 Writable => 'rational64u',
943 },
944 0x0086 => {
945 Name => 'DigitalZoom',
946 Writable => 'rational64u',
947 },
948 0x0087 => { #5
949 Name => 'FlashMode',
950 Writable => 'int8u',
951 PrintConv => {
952 0 => 'Did Not Fire',
953 1 => 'Fired, Manual', #14
954 3 => 'Not Ready', #28
955 7 => 'Fired, External', #14
956 8 => 'Fired, Commander Mode',
957 9 => 'Fired, TTL Mode',
958 },
959 },
960 0x0088 => [
961 {
962 Name => 'AFInfo',
963 Condition => '$$self{Model} =~ /^NIKON D/i',
964 SubDirectory => {
965 TagTable => 'Image::ExifTool::Nikon::AFInfo',
966 ByteOrder => 'BigEndian',
967 },
968 },
969 {
970 Name => 'AFInfo',
971 SubDirectory => {
972 TagTable => 'Image::ExifTool::Nikon::AFInfo',
973 ByteOrder => 'LittleEndian',
974 },
975 },
976 ],
977 0x0089 => { #5
978 Name => 'ShootingMode',
979 Writable => 'int16u',
980 # the meaning of bit 5 seems to change: For the D200 it indicates "Auto ISO" - PH
981 Notes => 'for the D70, Bit 5 = Unused LE-NR Slowdown',
982 # credit to Tom Christiansen (ref 7) for figuring this out...
983 # The (new?) bit 5 seriously complicates our life here: after firmwareB's
984 # 1.03, bit 5 turns on when you ask for BUT DO NOT USE the long-range
985 # noise reduction feature, probably because even not using it, it still
986 # slows down your drive operation to 50% (1.5fps max not 3fps). But no
987 # longer does !$val alone indicate single-frame operation. - TC, D70
988 PrintConv => q[
989 $_ = '';
990 unless ($val & 0x87) {
991 return 'Single-Frame' unless $val;
992 $_ = 'Single-Frame, ';
993 }
994 return $_ . Image::ExifTool::DecodeBits($val,
995 {
996 0 => 'Continuous',
997 1 => 'Delay',
998 2 => 'PC Control',
999 4 => 'Exposure Bracketing',
1000 5 => $$self{Model}=~/D70\b/ ? 'Unused LE-NR Slowdown' : 'Auto ISO',
1001 6 => 'White-Balance Bracketing',
1002 7 => 'IR Control',
1003 });
1004 ],
1005 },
1006 # 0x008a - called "AutoBracketRelease" by ref 15 [but this seems wrong]
1007 # values: 0,255 (when writing NEF only), or 1,2 (when writing JPEG or JPEG+NEF)
1008 # --> makes odd, repeating pattern in sequential NEF images (ref 28)
1009 0x008b => { #8
1010 Name => 'LensFStops',
1011 ValueConv => 'my ($a,$b,$c)=unpack("C3",$val); $c ? $a*($b/$c) : 0',
1012 ValueConvInv => 'my $a=int($val*12+0.5);$a<256 ? pack("C4",$a,1,12,0) : undef',
1013 PrintConv => 'sprintf("%.2f", $val)',
1014 PrintConvInv => '$val',
1015 Writable => 'undef',
1016 Count => 4,
1017 },
1018 0x008c => {
1019 Name => 'ContrastCurve', #JD
1020 Writable => 0,
1021 Binary => 1,
1022 },
1023 0x008d => { Name => 'ColorHue' , Writable => 'string' }, #2
1024 # SceneMode takes on the following values: PORTRAIT, PARTY/INDOOR, NIGHT PORTRAIT,
1025 # BEACH/SNOW, LANDSCAPE, SUNSET, NIGHT SCENE, MUSEUM, FIREWORKS, CLOSE UP, COPY,
1026 # BACK LIGHT, PANORAMA ASSIST, SPORT, DAWN/DUSK
1027 0x008f => { Name => 'SceneMode', Writable => 'string' }, #2
1028 # LightSource shows 3 values COLORED SPEEDLIGHT NATURAL.
1029 # (SPEEDLIGHT when flash goes. Have no idea about difference between other two.)
1030 0x0090 => { Name => 'LightSource', Writable => 'string' }, #2
1031 0x0091 => [ #18
1032 { #PH
1033 Condition => '$$valPt =~ /^0209/',
1034 Name => 'ShotInfoD40',
1035 SubDirectory => {
1036 TagTable => 'Image::ExifTool::Nikon::ShotInfoD40',
1037 DecryptStart => 4,
1038 DecryptLen => 748,
1039 ByteOrder => 'BigEndian',
1040 },
1041 },
1042 {
1043 Condition => '$$valPt =~ /^0208/',
1044 Name => 'ShotInfoD80',
1045 SubDirectory => {
1046 TagTable => 'Image::ExifTool::Nikon::ShotInfoD80',
1047 DecryptStart => 4,
1048 DecryptLen => 764,
1049 # (Capture NX can change the makernote byte order, but this stays big-endian)
1050 ByteOrder => 'BigEndian',
1051 },
1052 },
1053 { #PH (D90, firmware 1.00)
1054 Condition => '$$valPt =~ /^0213/',
1055 Name => 'ShotInfoD90',
1056 SubDirectory => {
1057 TagTable => 'Image::ExifTool::Nikon::ShotInfoD90',
1058 DecryptStart => 4,
1059 DecryptLen => 0x398,
1060 ByteOrder => 'BigEndian',
1061 },
1062 },
1063 { #PH (D3, firmware 0.37 and 1.00)
1064 Condition => '$$valPt =~ /^0210/ and $count == 5399',
1065 Name => 'ShotInfoD3a',
1066 SubDirectory => {
1067 TagTable => 'Image::ExifTool::Nikon::ShotInfoD3a',
1068 DecryptStart => 4,
1069 DecryptLen => 0x318,
1070 ByteOrder => 'BigEndian',
1071 },
1072 },
1073 { #PH (D3, firmware 1.10, 2.00 and 2.01 [count 5408], and 2.02 [count 5412])
1074 Condition => '$$valPt =~ /^0210/ and ($count == 5408 or $count == 5412)',
1075 Name => 'ShotInfoD3b',
1076 SubDirectory => {
1077 TagTable => 'Image::ExifTool::Nikon::ShotInfoD3b',
1078 DecryptStart => 4,
1079 DecryptLen => 0x321,
1080 ByteOrder => 'BigEndian',
1081 },
1082 },
1083 { #PH (D3X, firmware 1.00)
1084 Condition => '$$valPt =~ /^0214/ and $count == 5409',
1085 Name => 'ShotInfoD3X',
1086 SubDirectory => {
1087 TagTable => 'Image::ExifTool::Nikon::ShotInfoD3X',
1088 DecryptStart => 4,
1089 DecryptLen => 0x323,
1090 ByteOrder => 'BigEndian',
1091 },
1092 },
1093 { #PH (D3S, firmware 0.16 and 1.00)
1094 Condition => '$$valPt =~ /^0218/ and ($count == 5356 or $count == 5388)',
1095 Name => 'ShotInfoD3S',
1096 SubDirectory => {
1097 TagTable => 'Image::ExifTool::Nikon::ShotInfoD3S',
1098 DecryptStart => 4,
1099 DecryptLen => 0x2e6,
1100 ByteOrder => 'BigEndian',
1101 },
1102 },
1103 { #JD (D300, firmware 0.25 and 1.00)
1104 # D3 and D300 use the same version number, but the length is different
1105 Condition => '$$valPt =~ /^0210/ and $count == 5291',
1106 Name => 'ShotInfoD300a',
1107 SubDirectory => {
1108 TagTable => 'Image::ExifTool::Nikon::ShotInfoD300a',
1109 DecryptStart => 4,
1110 DecryptLen => 813,
1111 ByteOrder => 'BigEndian',
1112 },
1113 },
1114 { #PH (D300, firmware version 1.10)
1115 # yet again the same ShotInfoVersion for different data
1116 Condition => '$$valPt =~ /^0210/ and $count == 5303',
1117 Name => 'ShotInfoD300b',
1118 SubDirectory => {
1119 TagTable => 'Image::ExifTool::Nikon::ShotInfoD300b',
1120 DecryptStart => 4,
1121 DecryptLen => 825,
1122 ByteOrder => 'BigEndian',
1123 },
1124 },
1125 { #PH (D300S, firmware version 1.00)
1126 # yet again the same ShotInfoVersion for different data
1127 Condition => '$$valPt =~ /^0216/ and $count == 5311',
1128 Name => 'ShotInfoD300S',
1129 SubDirectory => {
1130 TagTable => 'Image::ExifTool::Nikon::ShotInfoD300S',
1131 DecryptStart => 4,
1132 DecryptLen => 827,
1133 ByteOrder => 'BigEndian',
1134 },
1135 },
1136 { #29 (D700 firmware version 1.02f)
1137 Condition => '$$valPt =~ /^0212/ and $count == 5312',
1138 Name => 'ShotInfoD700',
1139 SubDirectory => {
1140 TagTable => 'Image::ExifTool::Nikon::ShotInfoD700',
1141 ProcessProc => \&Image::ExifTool::Nikon::ProcessNikonEncrypted,
1142 WriteProc => \&Image::ExifTool::Nikon::ProcessNikonEncrypted,
1143 DecryptStart => 4,
1144 DecryptLen => 0x358,
1145 ByteOrder => 'BigEndian',
1146 },
1147 },
1148 { #PH
1149 Condition => '$$valPt =~ /^0215/ and $count == 6745',
1150 Name => 'ShotInfoD5000',
1151 SubDirectory => {
1152 TagTable => 'Image::ExifTool::Nikon::ShotInfoD5000',
1153 DecryptStart => 4,
1154 DecryptLen => 0x39a,
1155 ByteOrder => 'BigEndian',
1156 },
1157 },
1158 { #29 (D7000 firmware version 1.01b)
1159 Condition => '$$valPt =~ /^0220/',
1160 Name => 'ShotInfoD7000',
1161 SubDirectory => {
1162 TagTable => 'Image::ExifTool::Nikon::ShotInfoD7000',
1163 ProcessProc => \&Image::ExifTool::Nikon::ProcessNikonEncrypted,
1164 WriteProc => \&Image::ExifTool::Nikon::ProcessNikonEncrypted,
1165 DecryptStart => 4,
1166 DecryptLen => 0x448,
1167 ByteOrder => 'BigEndian',
1168 },
1169 },
1170 {
1171 Condition => '$$valPt =~ /^02/',
1172 Name => 'ShotInfo02xx',
1173 SubDirectory => {
1174 TagTable => 'Image::ExifTool::Nikon::ShotInfo',
1175 ProcessProc => \&Image::ExifTool::Nikon::ProcessNikonEncrypted,
1176 WriteProc => \&Image::ExifTool::Nikon::ProcessNikonEncrypted,
1177 DecryptStart => 4,
1178 DecryptLen => 0x251,
1179 ByteOrder => 'BigEndian',
1180 },
1181 },
1182 {
1183 Name => 'ShotInfoUnknown',
1184 Writable => 0,
1185 SubDirectory => {
1186 TagTable => 'Image::ExifTool::Nikon::ShotInfo',
1187 ByteOrder => 'BigEndian',
1188 },
1189 },
1190 ],
1191 0x0092 => { #2
1192 Name => 'HueAdjustment',
1193 Writable => 'int16s',
1194 },
1195 # 0x0093 - ref 15 calls this Saturation, but this is wrong - PH
1196 0x0093 => { #21
1197 Name => 'NEFCompression',
1198 Writable => 'int16u',
1199 PrintConv => {
1200 1 => 'Lossy (type 1)', # (older models)
1201 2 => 'Uncompressed', #JD - D100 (even though TIFF compression is set!)
1202 3 => 'Lossless',
1203 4 => 'Lossy (type 2)',
1204 },
1205 },
1206 0x0094 => { Name => 'Saturation', Writable => 'int16s' },
1207 0x0095 => { Name => 'NoiseReduction', Writable => 'string' },
1208 0x0096 => {
1209 Name => 'LinearizationTable', # same table as DNG LinearizationTable (ref JD)
1210 Writable => 0,
1211 Binary => 1,
1212 },
1213 0x0097 => [ #4
1214 # (NOTE: these are byte-swapped by NX when byte order changes)
1215 {
1216 Condition => '$$valPt =~ /^0100/', # (D100)
1217 Name => 'ColorBalance0100',
1218 SubDirectory => {
1219 Start => '$valuePtr + 72',
1220 TagTable => 'Image::ExifTool::Nikon::ColorBalance1',
1221 },
1222 },
1223 {
1224 Condition => '$$valPt =~ /^0102/', # (D2H)
1225 Name => 'ColorBalance0102',
1226 SubDirectory => {
1227 Start => '$valuePtr + 10',
1228 TagTable => 'Image::ExifTool::Nikon::ColorBalance2',
1229 },
1230 },
1231 {
1232 Condition => '$$valPt =~ /^0103/', # (D70)
1233 Name => 'ColorBalance0103',
1234 # D70: at file offset 'tag-value + base + 20', 4 16 bits numbers,
1235 # v[0]/v[1] , v[2]/v[3] are the red/blue multipliers.
1236 SubDirectory => {
1237 Start => '$valuePtr + 20',
1238 TagTable => 'Image::ExifTool::Nikon::ColorBalance3',
1239 },
1240 },
1241 {
1242 Condition => '$$valPt =~ /^0205/', # (D50)
1243 Name => 'ColorBalance0205',
1244 SubDirectory => {
1245 TagTable => 'Image::ExifTool::Nikon::ColorBalance2',
1246 ProcessProc => \&Image::ExifTool::Nikon::ProcessNikonEncrypted,
1247 WriteProc => \&Image::ExifTool::Nikon::ProcessNikonEncrypted,
1248 DecryptStart => 4,
1249 DecryptLen => 22, # 284 bytes encrypted, but don't need to decrypt it all
1250 DirOffset => 14,
1251 },
1252 },
1253 {
1254 Condition => '$$valPt =~ /^0209/', # (D3)
1255 Name => 'ColorBalance0209',
1256 SubDirectory => {
1257 TagTable => 'Image::ExifTool::Nikon::ColorBalance4',
1258 ProcessProc => \&Image::ExifTool::Nikon::ProcessNikonEncrypted,
1259 WriteProc => \&Image::ExifTool::Nikon::ProcessNikonEncrypted,
1260 DecryptStart => 284,
1261 DecryptLen => 18, # don't need to decrypt it all
1262 DirOffset => 10,
1263 },
1264 },
1265 { # (D2X=0204,D2Hs=0206,D200=0207,D40=0208)
1266 Condition => '$$valPt =~ /^02(\d{2})/ and $1 < 11',
1267 Name => 'ColorBalance02',
1268 SubDirectory => {
1269 TagTable => 'Image::ExifTool::Nikon::ColorBalance2',
1270 ProcessProc => \&Image::ExifTool::Nikon::ProcessNikonEncrypted,
1271 WriteProc => \&Image::ExifTool::Nikon::ProcessNikonEncrypted,
1272 DecryptStart => 284,
1273 DecryptLen => 14, # 324 bytes encrypted, but don't need to decrypt it all
1274 DirOffset => 6,
1275 },
1276 },
1277 { # (D90/D5000=0211,D300S=0212,D3000=0213,D3S=0214,D3100=0215,D7000/D5100=0216)
1278 Name => 'ColorBalanceUnknown',
1279 Writable => 0,
1280 },
1281 ],
1282 0x0098 => [
1283 { #8
1284 Condition => '$$valPt =~ /^0100/', # D100, D1X - PH
1285 Name => 'LensData0100',
1286 SubDirectory => { TagTable => 'Image::ExifTool::Nikon::LensData00' },
1287 },
1288 { #8
1289 Condition => '$$valPt =~ /^0101/', # D70, D70s - PH
1290 Name => 'LensData0101',
1291 SubDirectory => { TagTable => 'Image::ExifTool::Nikon::LensData01' },
1292 },
1293 # note: this information is encrypted if the version is 02xx
1294 { #8
1295 # 0201 - D200, D2Hs, D2X and D2Xs
1296 # 0202 - D40, D40X and D80
1297 # 0203 - D300
1298 Condition => '$$valPt =~ /^020[1-3]/',
1299 Name => 'LensData0201',
1300 SubDirectory => {
1301 TagTable => 'Image::ExifTool::Nikon::LensData01',
1302 ProcessProc => \&Image::ExifTool::Nikon::ProcessNikonEncrypted,
1303 WriteProc => \&Image::ExifTool::Nikon::ProcessNikonEncrypted,
1304 DecryptStart => 4,
1305 },
1306 },
1307 { #PH
1308 Condition => '$$valPt =~ /^0204/', # D90, D7000
1309 Name => 'LensData0204',
1310 SubDirectory => {
1311 TagTable => 'Image::ExifTool::Nikon::LensData0204',
1312 ProcessProc => \&Image::ExifTool::Nikon::ProcessNikonEncrypted,
1313 WriteProc => \&Image::ExifTool::Nikon::ProcessNikonEncrypted,
1314 DecryptStart => 4,
1315 },
1316 },
1317 {
1318 Name => 'LensDataUnknown',
1319 SubDirectory => {
1320 TagTable => 'Image::ExifTool::Nikon::LensDataUnknown',
1321 },
1322 },
1323 ],
1324 0x0099 => { #2/15
1325 Name => 'RawImageCenter',
1326 Writable => 'int16u',
1327 Count => 2,
1328 },
1329 0x009a => { #10
1330 Name => 'SensorPixelSize',
1331 Writable => 'rational64u',
1332 Count => 2,
1333 PrintConv => '$val=~s/ / x /;"$val um"',
1334 PrintConvInv => '$val=~tr/a-zA-Z/ /;$val',
1335 },
1336 0x009c => { #14
1337 # L2/L3 has these modes (from owner's manual): - PH
1338 # Portrait Assist: FACE-PRIORITY AF,PORTRAIT,PORTRAIT LEFT,PORTRAIT RIGHT,
1339 # PORTRAIT CLOSE-UP,PORTRAIT COUPLE,PORTRAIT-FIGURE
1340 # Landscape Assist:LANDSCAPE,SCENIC VIEW,ARCHITECTURE,GROUP RIGHT,GROUP LEFT
1341 # Sports Assist: SPORTS,SPORT SPECTATOR,SPORT COMPOSITE
1342 Name => 'SceneAssist',
1343 Writable => 'string',
1344 },
1345 0x009e => { #JD
1346 Name => 'RetouchHistory',
1347 Writable => 'int16u',
1348 Count => 10,
1349 # trim off extra "None" values
1350 ValueConv => '$val=~s/( 0)+$//; $val',
1351 ValueConvInv => 'my $n=($val=~/ \d+/g);$n < 9 ? $val . " 0" x (9-$n) : $val',
1352 PrintConvColumns => 2,
1353 PrintConv => [
1354 \%retouchValues,
1355 \%retouchValues,
1356 \%retouchValues,
1357 \%retouchValues,
1358 \%retouchValues,
1359 \%retouchValues,
1360 \%retouchValues,
1361 \%retouchValues,
1362 \%retouchValues,
1363 \%retouchValues,
1364 ],
1365 },
1366 0x00a0 => { Name => 'SerialNumber', Writable => 'string' }, #2
1367 0x00a2 => { # size of compressed image data plus EOI segment (ref 10)
1368 Name => 'ImageDataSize',
1369 Writable => 'int32u',
1370 },
1371 # 0x00a3 - int8u: 0 (All DSLR's but D1,D1H,D1X,D100)
1372 # 0x00a4 - version number found only in NEF images from DSLR models except the
1373 # D1,D1X,D2H and D100. Value is "0200" for all available samples except images
1374 # edited by Nikon Capture Editor 4.3.1 W and 4.4.2 which have "0100" - PH
1375 0x00a5 => { #15
1376 Name => 'ImageCount',
1377 Writable => 'int32u',
1378 },
1379 0x00a6 => { #15
1380 Name => 'DeletedImageCount',
1381 Writable => 'int32u',
1382 },
1383 # the sum of 0xa5 and 0xa6 is equal to 0xa7 ShutterCount (D2X,D2Hs,D2H,D200, ref 10)
1384 0x00a7 => { # Number of shots taken by camera so far (ref 2)
1385 Name => 'ShutterCount',
1386 Writable => 'int32u',
1387 Protected => 1,
1388 Notes => q{
1389 this value is used as a key to decrypt other information -- writing this tag
1390 causes the other information to be re-encrypted with the new key
1391 },
1392 },
1393 0x00a8 => [#JD
1394 {
1395 Name => 'FlashInfo0100',
1396 Condition => '$$valPt =~ /^010[01]/',
1397 SubDirectory => { TagTable => 'Image::ExifTool::Nikon::FlashInfo0100' },
1398 },
1399 {
1400 Name => 'FlashInfo0102',
1401 Condition => '$$valPt =~ /^0102/',
1402 SubDirectory => { TagTable => 'Image::ExifTool::Nikon::FlashInfo0102' },
1403 },
1404 {
1405 Name => 'FlashInfo0103',
1406 Condition => '$$valPt =~ /^0103/',
1407 SubDirectory => { TagTable => 'Image::ExifTool::Nikon::FlashInfo0103' },
1408 },
1409 { #29 (D7000, NC)
1410 Name => 'FlashInfo0104',
1411 Condition => '$$valPt =~ /^0104/',
1412 SubDirectory => { TagTable => 'Image::ExifTool::Nikon::FlashInfo0103' },
1413 },
1414 {
1415 Name => 'FlashInfoUnknown',
1416 SubDirectory => { TagTable => 'Image::ExifTool::Nikon::FlashInfoUnknown' },
1417 },
1418 ],
1419 0x00a9 => { Name => 'ImageOptimization',Writable => 'string' },#2
1420 0x00aa => { Name => 'Saturation', Writable => 'string' }, #2
1421 0x00ab => { Name => 'VariProgram', Writable => 'string' }, #2 (scene mode for DSLR's - PH)
1422 0x00ac => { Name => 'ImageStabilization',Writable=> 'string' }, #14
1423 0x00ad => { Name => 'AFResponse', Writable => 'string' }, #14
1424 0x00b0 => { #PH
1425 Name => 'MultiExposure',
1426 Condition => '$$valPt =~ /^0100/',
1427 SubDirectory => { TagTable => 'Image::ExifTool::Nikon::MultiExposure' },
1428 },
1429 0x00b1 => { #14/PH/JD (D80)
1430 Name => 'HighISONoiseReduction',
1431 Writable => 'int16u',
1432 PrintConv => {
1433 0 => 'Off',
1434 1 => 'Minimal', # for high ISO (>800) when setting is "Off"
1435 2 => 'Low', # Low,Normal,High take effect for ISO > 400
1436 4 => 'Normal',
1437 6 => 'High',
1438 },
1439 },
1440 # 0x00b2 (string: 'Normal', 0xc3's, 0xff's or 0x20's)
1441 0x00b3 => { #14
1442 Name => 'ToningEffect',
1443 Writable => 'string',
1444 },
1445 0x00b6 => { #PH
1446 Name => 'PowerUpTime',
1447 Groups => { 2 => 'Time' },
1448 Shift => 'Time',
1449 # not clear whether "powered up" means "turned on" or "power applied" - PH
1450 Notes => 'date/time when camera was last powered up',
1451 Writable => 'undef',
1452 # must use RawConv so byte order is correct
1453 RawConv => sub {
1454 my $val = shift;
1455 return $val if length $val < 7;
1456 my $shrt = GetByteOrder() eq 'II' ? 'v' : 'n';
1457 my @date = unpack("${shrt}C5", $val);
1458 return sprintf('%.4d:%.2d:%.2d %.2d:%.2d:%.2d', @date);
1459 },
1460 RawConvInv => sub {
1461 my $val = shift;
1462 my $shrt = GetByteOrder() eq 'II' ? 'v' : 'n';
1463 my @date = ($val =~ /\d+/g);
1464 return pack("${shrt}C6", @date, 0);
1465 },
1466 PrintConv => '$self->ConvertDateTime($val)',
1467 PrintConvInv => '$self->InverseDateTime($val,0)',
1468 },
1469 0x00b7 => { #JD
1470 Name => 'AFInfo2',
1471 SubDirectory => { TagTable => 'Image::ExifTool::Nikon::AFInfo2' },
1472 },
1473 0x00b8 => { #PH
1474 Name => 'FileInfo',
1475 SubDirectory => {
1476 TagTable => 'Image::ExifTool::Nikon::FileInfo',
1477 ByteOrder => 'BigEndian',
1478 },
1479 },
1480 0x00b9 => { #28
1481 Name => 'AFTune',
1482 SubDirectory => { TagTable => 'Image::ExifTool::Nikon::AFTune' },
1483 },
1484 # 0x00ba - custom curve data? (ref 28?) (only in NEF images)
1485 0x00bd => { #PH (P6000)
1486 Name => 'PictureControlData',
1487 Writable => 'undef',
1488 Permanent => 0,
1489 Binary => 1,
1490 SubDirectory => { TagTable => 'Image::ExifTool::Nikon::PictureControl' },
1491 },
1492 0x0e00 => {
1493 Name => 'PrintIM',
1494 Description => 'Print Image Matching',
1495 Writable => 0,
1496 SubDirectory => {
1497 TagTable => 'Image::ExifTool::PrintIM::Main',
1498 },
1499 },
1500 # 0x0e01 - In D70 NEF files produced by Nikon Capture, the data for this tag extends 4 bytes
1501 # past the end of the maker notes. Very odd. I hope these 4 bytes aren't useful because
1502 # they will get lost by any utility that blindly copies the maker notes (not ExifTool) - PH
1503 0x0e01 => {
1504 Name => 'NikonCaptureData',
1505 Writable => 'undef',
1506 Permanent => 0,
1507 Drop => 1, # (may be too large for JPEG images)
1508 Binary => 1,
1509 Notes => q{
1510 this data is dropped when copying Nikon MakerNotes since it may be too large
1511 to fit in the EXIF segment of a JPEG image, but it may be copied as a block
1512 into existing Nikon MakerNotes later if desired
1513 },
1514 SubDirectory => {
1515 DirName => 'NikonCapture',
1516 TagTable => 'Image::ExifTool::NikonCapture::Main',
1517 },
1518 },
1519 # 0x0e05 written by Nikon Capture to NEF files, values of 1 and 2 - PH
1520 0x0e09 => { #12
1521 Name => 'NikonCaptureVersion',
1522 Writable => 'string',
1523 PrintConv => undef,
1524 },
1525 # 0x0e0e is in D70 Nikon Capture files (not out-of-the-camera D70 files) - PH
1526 0x0e0e => { #PH
1527 Name => 'NikonCaptureOffsets',
1528 SubDirectory => {
1529 TagTable => 'Image::ExifTool::Nikon::CaptureOffsets',
1530 Validate => '$val =~ /^0100/',
1531 Start => '$valuePtr + 4',
1532 },
1533 },
1534 0x0e10 => { #17
1535 Name => 'NikonScanIFD',
1536 Groups => { 1 => 'NikonScan', 2 => 'Image' },
1537 Flags => 'SubIFD',
1538 SubDirectory => {
1539 TagTable => 'Image::ExifTool::Nikon::Scan',
1540 Start => '$val',
1541 },
1542 },
1543 0x0e13 => [{ # PH/http://u88.n24.queensu.ca/exiftool/forum/index.php/topic,2737.0.html
1544 Name => 'NikonCaptureEditVersions',
1545 Condition => '$self->Options("ExtractEmbedded")',
1546 Notes => q{
1547 the ExtractEmbedded option may be used to decode settings from the stored
1548 edit versions, otherwise this is extracted as a binary data block
1549 },
1550 Writable => 'undef',
1551 Permanent => 0,
1552 Drop => 1, # (may be too large for JPEG images)
1553 SubDirectory => {
1554 DirName => 'NikonCaptureEditVersions',
1555 TagTable => 'Image::ExifTool::NikonCapture::Main',
1556 ProcessProc => \&ProcessNikonCaptureEditVersions,
1557 WriteProc => sub { return undef }, # (writing not yet supported)
1558 },
1559 },{
1560 Name => 'NikonCaptureEditVersions',
1561 Writable => 'undef',
1562 Permanent => 0,
1563 Binary => 1,
1564 Drop => 1,
1565 }],
1566 0x0e1d => { #JD
1567 Name => 'NikonICCProfile',
1568 Binary => 1,
1569 Protected => 1,
1570 Writable => 'undef', # must be defined here so tag will be extracted if specified
1571 WriteCheck => q{
1572 require Image::ExifTool::ICC_Profile;
1573 return Image::ExifTool::ICC_Profile::ValidateICC(\$val);
1574 },
1575 SubDirectory => {
1576 DirName => 'NikonICCProfile',
1577 TagTable => 'Image::ExifTool::ICC_Profile::Main',
1578 },
1579 },
1580 0x0e1e => { #PH
1581 Name => 'NikonCaptureOutput',
1582 Writable => 'undef',
1583 Permanent => 0,
1584 Binary => 1,
1585 SubDirectory => {
1586 TagTable => 'Image::ExifTool::Nikon::CaptureOutput',
1587 Validate => '$val =~ /^0100/',
1588 },
1589 },
1590 0x0e22 => { #28
1591 Name => 'NEFBitDepth',
1592 Writable => 'int16u',
1593 Count => 4,
1594 Protected => 1,
1595 PrintConv => {
1596 '0 0 0 0' => 'n/a (JPEG)',
1597 '8 8 8 0' => '8 x 3', # TIFF RGB
1598 '12 0 0 0' => 12,
1599 '14 0 0 0' => 14,
1600 },
1601 },
1602);
1603
1604# NikonScan IFD entries (ref 17)
1605%Image::ExifTool::Nikon::Scan = (
1606 WRITE_PROC => \&Image::ExifTool::Exif::WriteExif,
1607 CHECK_PROC => \&Image::ExifTool::Exif::CheckExif,
1608 WRITE_GROUP => 'NikonScan',
1609 WRITABLE => 1,
1610 GROUPS => { 0 => 'MakerNotes', 1 => 'NikonScan', 2 => 'Image' },
1611 VARS => { MINOR_ERRORS => 1 }, # this IFD is non-essential and often corrupted
1612 NOTES => 'This information is written by the Nikon Scan software.',
1613 0x02 => { Name => 'FilmType', Writable => 'string', },
1614 0x40 => { Name => 'MultiSample', Writable => 'string' },
1615 0x41 => { Name => 'BitDepth', Writable => 'int16u' },
1616 0x50 => {
1617 Name => 'MasterGain',
1618 Writable => 'rational64s',
1619 PrintConv => 'sprintf("%.2f",$val)',
1620 PrintConvInv => '$val',
1621 },
1622 0x51 => {
1623 Name => 'ColorGain',
1624 Writable => 'rational64s',
1625 Count => 3,
1626 PrintConv => 'sprintf("%.2f %.2f %.2f",split(" ",$val))',
1627 PrintConvInv => '$val',
1628 },
1629 0x60 => {
1630 Name => 'ScanImageEnhancer',
1631 Writable => 'int32u',
1632 PrintConv => \%offOn,
1633 },
1634 0x100 => { Name => 'DigitalICE', Writable => 'string' },
1635 0x110 => {
1636 Name => 'ROCInfo',
1637 SubDirectory => { TagTable => 'Image::ExifTool::Nikon::ROC' },
1638 },
1639 0x120 => {
1640 Name => 'GEMInfo',
1641 SubDirectory => { TagTable => 'Image::ExifTool::Nikon::GEM' },
1642 },
1643 0x200 => { Name => 'DigitalDEEShadowAdj', Writable => 'int32u' },
1644 0x201 => { Name => 'DigitalDEEThreshold', Writable => 'int32u' },
1645 0x202 => { Name => 'DigitalDEEHighlightAdj',Writable => 'int32u' },
1646);
1647
1648# ref 17
1649%Image::ExifTool::Nikon::ROC = (
1650 %binaryDataAttrs,
1651 FORMAT => 'int32u',
1652 GROUPS => { 0 => 'MakerNotes', 1 => 'NikonScan', 2 => 'Image' },
1653 0 => {
1654 Name => 'DigitalROC',
1655 ValueConv => '$val / 10',
1656 ValueConvInv => 'int($val * 10)',
1657 },
1658);
1659
1660# ref 17
1661%Image::ExifTool::Nikon::GEM = (
1662 %binaryDataAttrs,
1663 FORMAT => 'int32u',
1664 GROUPS => { 0 => 'MakerNotes', 1 => 'NikonScan', 2 => 'Image' },
1665 0 => {
1666 Name => 'DigitalGEM',
1667 ValueConv => '$val<95 ? $val/20-1 : 4',
1668 ValueConvInv => '$val == 4 ? 95 : int(($val + 1) * 20)',
1669 },
1670);
1671
1672# Vibration Reduction information - PH (D300)
1673%Image::ExifTool::Nikon::VRInfo = (
1674 %binaryDataAttrs,
1675 GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
1676 # NOTE: Must set ByteOrder in SubDirectory if any multi-byte integer tags added
1677 0 => {
1678 Name => 'VRInfoVersion',
1679 Format => 'undef[4]',
1680 Writable => 0,
1681 },
1682 4 => {
1683 Name => 'VibrationReduction',
1684 PrintConv => {
1685 1 => 'On',
1686 2 => 'Off',
1687 },
1688 },
1689 # 5 - values: 0, 1, 2
1690 # 6 and 7 - values: 0
1691);
1692
1693# Face detection information - PH (S8100)
1694%Image::ExifTool::Nikon::FaceDetect = (
1695 %binaryDataAttrs,
1696 GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
1697 FORMAT => 'int16u',
1698 DATAMEMBER => [ 0x03 ],
1699 0x01 => {
1700 Name => 'FaceDetectFrameSize',
1701 Format => 'int16u[2]',
1702 },
1703 0x03 => {
1704 Name => 'FacesDetected',
1705 DataMember => 'FacesDetected',
1706 RawConv => '$$self{FacesDetected} = $val',
1707 },
1708 0x04 => {
1709 Name => 'Face1Position',
1710 Format => 'int16u[4]',
1711 RawConv => '$$self{FacesDetected} < 1 ? undef : $val',
1712 Notes => q{
1713 top, left, width and height of face detect area in coordinates of
1714 FaceDetectFrameSize
1715 },
1716 },
1717 0x08 => {
1718 Name => 'Face2Position',
1719 Format => 'int16u[4]',
1720 RawConv => '$$self{FacesDetected} < 2 ? undef : $val',
1721 },
1722 0x0c => {
1723 Name => 'Face3Position',
1724 Format => 'int16u[4]',
1725 RawConv => '$$self{FacesDetected} < 3 ? undef : $val',
1726 },
1727 0x10 => {
1728 Name => 'Face4Position',
1729 Format => 'int16u[4]',
1730 RawConv => '$$self{FacesDetected} < 4 ? undef : $val',
1731 },
1732 0x14 => {
1733 Name => 'Face5Position',
1734 Format => 'int16u[4]',
1735 RawConv => '$$self{FacesDetected} < 5 ? undef : $val',
1736 },
1737 0x18 => {
1738 Name => 'Face6Position',
1739 Format => 'int16u[4]',
1740 RawConv => '$$self{FacesDetected} < 6 ? undef : $val',
1741 },
1742 0x1c => {
1743 Name => 'Face7Position',
1744 Format => 'int16u[4]',
1745 RawConv => '$$self{FacesDetected} < 7 ? undef : $val',
1746 },
1747 0x20 => {
1748 Name => 'Face8Position',
1749 Format => 'int16u[4]',
1750 RawConv => '$$self{FacesDetected} < 8 ? undef : $val',
1751 },
1752 0x24 => {
1753 Name => 'Face9Position',
1754 Format => 'int16u[4]',
1755 RawConv => '$$self{FacesDetected} < 9 ? undef : $val',
1756 },
1757 0x28 => {
1758 Name => 'Face10Position',
1759 Format => 'int16u[4]',
1760 RawConv => '$$self{FacesDetected} < 10 ? undef : $val',
1761 },
1762 0x2c => {
1763 Name => 'Face11Position',
1764 Format => 'int16u[4]',
1765 RawConv => '$$self{FacesDetected} < 11 ? undef : $val',
1766 },
1767 0x30 => {
1768 Name => 'Face12Position',
1769 Format => 'int16u[4]',
1770 RawConv => '$$self{FacesDetected} < 12 ? undef : $val',
1771 },
1772);
1773
1774# Picture Control information - PH (D300,P6000)
1775%Image::ExifTool::Nikon::PictureControl = (
1776 %binaryDataAttrs,
1777 GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
1778 # NOTE: Must set ByteOrder in SubDirectory if any multi-byte integer tags added
1779 0 => {
1780 Name => 'PictureControlVersion',
1781 Format => 'undef[4]',
1782 Writable => 0,
1783 },
1784 4 => {
1785 Name => 'PictureControlName',
1786 Format => 'string[20]',
1787 # make lower case with a leading capital for each word
1788 PrintConv => \&FormatString,
1789 PrintConvInv => 'uc($val)',
1790 },
1791 24 => {
1792 Name => 'PictureControlBase',
1793 Format => 'string[20]',
1794 PrintConv => \&FormatString,
1795 PrintConvInv => 'uc($val)',
1796 },
1797 # beginning at byte 44, there is some interesting information.
1798 # here are the observed bytes for each PictureControlMode:
1799 # 44 45 46 47 48 49 50 51 52 53 54 55 56 57
1800 # STANDARD 00 01 00 00 00 80 83 80 80 80 80 ff ff ff
1801 # NEUTRAL 03 c2 00 00 00 ff 82 80 80 80 80 ff ff ff
1802 # VIVID 00 c3 00 00 00 80 84 80 80 80 80 ff ff ff
1803 # MONOCHROME 06 4d 00 01 02 ff 82 80 80 ff ff 80 80 ff
1804 # Neutral2 03 c2 01 00 02 ff 80 7f 81 00 7f ff ff ff (custom)
1805 # (note that up to 9 different custom picture controls can be stored)
1806 #
1807 48 => { #21
1808 Name => 'PictureControlAdjust',
1809 PrintConv => {
1810 0 => 'Default Settings',
1811 1 => 'Quick Adjust',
1812 2 => 'Full Control',
1813 },
1814 },
1815 49 => {
1816 Name => 'PictureControlQuickAdjust',
1817 # settings: -2 to +2 (n/a for Neutral and Monochrome modes)
1818 DelValue => 0xff,
1819 ValueConv => '$val - 0x80',
1820 ValueConvInv => '$val + 0x80',
1821 PrintConv => 'Image::ExifTool::Nikon::PrintPC($val)',
1822 PrintConvInv => 'Image::ExifTool::Nikon::PrintPCInv($val)',
1823 },
1824 50 => {
1825 Name => 'Sharpness',
1826 # settings: 0 to 9, Auto
1827 ValueConv => '$val - 0x80',
1828 ValueConvInv => '$val + 0x80',
1829 PrintConv => 'Image::ExifTool::Nikon::PrintPC($val,"No Sharpening","%d")',
1830 PrintConvInv => 'Image::ExifTool::Nikon::PrintPCInv($val)',
1831 },
1832 51 => {
1833 Name => 'Contrast',
1834 # settings: -3 to +3, Auto
1835 ValueConv => '$val - 0x80',
1836 ValueConvInv => '$val + 0x80',
1837 PrintConv => 'Image::ExifTool::Nikon::PrintPC($val)',
1838 PrintConvInv => 'Image::ExifTool::Nikon::PrintPCInv($val)',
1839 },
1840 52 => {
1841 Name => 'Brightness',
1842 # settings: -1 to +1
1843 ValueConv => '$val - 0x80',
1844 ValueConvInv => '$val + 0x80',
1845 PrintConv => 'Image::ExifTool::Nikon::PrintPC($val)',
1846 PrintConvInv => 'Image::ExifTool::Nikon::PrintPCInv($val)',
1847 },
1848 53 => {
1849 Name => 'Saturation',
1850 # settings: -3 to +3, Auto (n/a for Monochrome mode)
1851 DelValue => 0xff,
1852 ValueConv => '$val - 0x80',
1853 ValueConvInv => '$val + 0x80',
1854 PrintConv => 'Image::ExifTool::Nikon::PrintPC($val)',
1855 PrintConvInv => 'Image::ExifTool::Nikon::PrintPCInv($val)',
1856 },
1857 54 => {
1858 Name => 'HueAdjustment',
1859 # settings: -3 to +3 (n/a for Monochrome mode)
1860 DelValue => 0xff,
1861 ValueConv => '$val - 0x80',
1862 ValueConvInv => '$val + 0x80',
1863 PrintConv => 'Image::ExifTool::Nikon::PrintPC($val,"None")',
1864 PrintConvInv => 'Image::ExifTool::Nikon::PrintPCInv($val)',
1865 },
1866 55 => {
1867 Name => 'FilterEffect',
1868 # settings: Off,Yellow,Orange,Red,Green (n/a for color modes)
1869 DelValue => 0xff,
1870 PrintHex => 1,
1871 PrintConv => {
1872 0x80 => 'Off',
1873 0x81 => 'Yellow',
1874 0x82 => 'Orange',
1875 0x83 => 'Red',
1876 0x84 => 'Green',
1877 0xff => 'n/a',
1878 },
1879 },
1880 56 => {
1881 Name => 'ToningEffect',
1882 # settings: B&W,Sepia,Cyanotype,Red,Yellow,Green,Blue-Green,Blue,
1883 # Purple-Blue,Red-Purple (n/a for color modes)
1884 DelValue => 0xff,
1885 PrintHex => 1,
1886 PrintConvColumns => 2,
1887 PrintConv => {
1888 0x80 => 'B&W',
1889 0x81 => 'Sepia',
1890 0x82 => 'Cyanotype',
1891 0x83 => 'Red',
1892 0x84 => 'Yellow',
1893 0x85 => 'Green',
1894 0x86 => 'Blue-green',
1895 0x87 => 'Blue',
1896 0x88 => 'Purple-blue',
1897 0x89 => 'Red-purple',
1898 0xff => 'n/a',
1899 },
1900 },
1901 57 => { #21
1902 Name => 'ToningSaturation',
1903 # settings: B&W,Sepia,Cyanotype,Red,Yellow,Green,Blue-Green,Blue,
1904 # Purple-Blue,Red-Purple (n/a unless ToningEffect is used)
1905 DelValue => 0xff,
1906 ValueConv => '$val - 0x80',
1907 ValueConvInv => '$val + 0x80',
1908 PrintConv => '$val==0x7f ? "n/a" : $val',
1909 PrintConvInv => 'Image::ExifTool::Nikon::PrintPCInv($val)',
1910 },
1911);
1912
1913# World Time information - JD (D300)
1914%Image::ExifTool::Nikon::WorldTime = (
1915 %binaryDataAttrs,
1916 GROUPS => { 0 => 'MakerNotes', 2 => 'Time' },
1917 0 => {
1918 Name => 'Timezone',
1919 Format => 'int16s',
1920 PrintConv => q{
1921 my $sign = $val < 0 ? '-' : '+';
1922 my $h = int(abs($val) / 60);
1923 sprintf("%s%.2d:%.2d", $sign, $h, abs($val)-60*$h);
1924 },
1925 PrintConvInv => q{
1926 $val =~ /([-+]?)(\d+):(\d+)/ or return undef;
1927 return $1 . ($2 * 60 + $3);
1928 },
1929 },
1930 2 => {
1931 Name => 'DaylightSavings',
1932 PrintConv => { 0 => 'No', 1 => 'Yes' },
1933 },
1934 3 => {
1935 Name => 'DateDisplayFormat',
1936 PrintConv => {
1937 0 => 'Y/M/D',
1938 1 => 'M/D/Y',
1939 2 => 'D/M/Y',
1940 },
1941 },
1942);
1943
1944# ISO information - PH (D300)
1945%Image::ExifTool::Nikon::ISOInfo = (
1946 %binaryDataAttrs,
1947 GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
1948 0 => {
1949 Name => 'ISO',
1950 Notes => 'val = 100 * 2**(raw/12-5)',
1951 Priority => 0, # because people like to see rounded-off values if they exist
1952 ValueConv => '100*exp(($val/12-5)*log(2))',
1953 ValueConvInv => '(log($val/100)/log(2)+5)*12',
1954 PrintConv => 'int($val + 0.5)',
1955 PrintConvInv => '$val',
1956 },
1957 # 1 - 0x01
1958 # 2 - 0x0c (probably the ISO divisor above)
1959 # 3 - 0x00
1960 4 => {
1961 Name => 'ISOExpansion',
1962 Format => 'int16u',
1963 PrintHex => 1,
1964 PrintConvColumns => 2,
1965 PrintConv => {
1966 0x000 => 'Off',
1967 0x101 => 'Hi 0.3',
1968 0x102 => 'Hi 0.5',
1969 0x103 => 'Hi 0.7',
1970 0x104 => 'Hi 1.0',
1971 0x105 => 'Hi 1.3', # (Hi 1.3-1.7 may be possible with future models)
1972 0x106 => 'Hi 1.5',
1973 0x107 => 'Hi 1.7',
1974 0x108 => 'Hi 2.0', #(NC) - D3 should have this mode
1975 0x201 => 'Lo 0.3',
1976 0x202 => 'Lo 0.5',
1977 0x203 => 'Lo 0.7',
1978 0x204 => 'Lo 1.0',
1979 },
1980 },
1981 # bytes 6-11 same as 0-4 in my samples (why is this duplicated?)
1982 6 => {
1983 Name => 'ISO2',
1984 Notes => 'val = 100 * 2**(raw/12-5)',
1985 ValueConv => '100*exp(($val/12-5)*log(2))',
1986 ValueConvInv => '(log($val/100)/log(2)+5)*12',
1987 PrintConv => 'int($val + 0.5)',
1988 PrintConvInv => '$val',
1989 },
1990 # 7 - 0x01
1991 # 8 - 0x0c (probably the ISO divisor above)
1992 # 9 - 0x00
1993 10 => {
1994 Name => 'ISOExpansion2',
1995 Format => 'int16u',
1996 PrintHex => 1,
1997 PrintConvColumns => 2,
1998 PrintConv => {
1999 0x000 => 'Off',
2000 0x101 => 'Hi 0.3',
2001 0x102 => 'Hi 0.5',
2002 0x103 => 'Hi 0.7',
2003 0x104 => 'Hi 1.0',
2004 0x105 => 'Hi 1.3', # (Hi 1.3-1.7 may be possible with future models)
2005 0x106 => 'Hi 1.5',
2006 0x107 => 'Hi 1.7',
2007 0x108 => 'Hi 2.0', #(NC) - D3 should have this mode
2008 0x201 => 'Lo 0.3',
2009 0x202 => 'Lo 0.5',
2010 0x203 => 'Lo 0.7',
2011 0x204 => 'Lo 1.0',
2012 },
2013 },
2014 # bytes 12-13: 00 00
2015);
2016
2017# distortion information - PH (D5000)
2018%Image::ExifTool::Nikon::DistortInfo = (
2019 %binaryDataAttrs,
2020 GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
2021 0 => {
2022 Name => 'DistortionVersion',
2023 Format => 'undef[4]',
2024 Writable => 0,
2025 Unknown => 1,
2026 },
2027 4 => {
2028 Name => 'AutoDistortionControl',
2029 PrintConv => \%offOn,
2030 },
2031);
2032
2033# unknown information - PH (D7000)
2034%Image::ExifTool::Nikon::UnknownInfo = (
2035 %binaryDataAttrs,
2036 FORMAT => 'int32u',
2037 GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
2038 0 => {
2039 Name => 'UnknownInfoVersion',
2040 Condition => '$$valPt =~ /^\d{4}/',
2041 Format => 'undef[4]',
2042 Writable => 0,
2043 Unknown => 1,
2044 },
2045);
2046
2047# more unknown information - PH (D7000)
2048%Image::ExifTool::Nikon::UnknownInfo2 = (
2049 %binaryDataAttrs,
2050 FORMAT => 'int32u',
2051 GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
2052 0 => {
2053 Name => 'UnknownInfo2Version',
2054 Condition => '$$valPt =~ /^\d{4}/',
2055 Format => 'undef[4]',
2056 Writable => 0,
2057 Unknown => 1,
2058 },
2059);
2060
2061# Nikon AF information (ref 13)
2062%Image::ExifTool::Nikon::AFInfo = (
2063 %binaryDataAttrs,
2064 GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
2065 0 => {
2066 Name => 'AFAreaMode',
2067 PrintConv => {
2068 0 => 'Single Area',
2069 1 => 'Dynamic Area',
2070 2 => 'Dynamic Area (closest subject)',
2071 3 => 'Group Dynamic',
2072 4 => 'Single Area (wide)',
2073 5 => 'Dynamic Area (wide)',
2074 },
2075 },
2076 1 => {
2077 Name => 'AFPoint',
2078 Notes => 'in some focus modes this value is not meaningful',
2079 PrintConvColumns => 2,
2080 PrintConv => {
2081 0 => 'Center',
2082 1 => 'Top',
2083 2 => 'Bottom',
2084 3 => 'Mid-left',
2085 4 => 'Mid-right',
2086 5 => 'Upper-left',
2087 6 => 'Upper-right',
2088 7 => 'Lower-left',
2089 8 => 'Lower-right',
2090 9 => 'Far Left',
2091 10 => 'Far Right',
2092 },
2093 },
2094 2 => {
2095 Name => 'AFPointsInFocus',
2096 Format => 'int16u',
2097 PrintConvColumns => 2,
2098 PrintConv => {
2099 0x7ff => 'All 11 Points',
2100 BITMASK => {
2101 0 => 'Center',
2102 1 => 'Top',
2103 2 => 'Bottom',
2104 3 => 'Mid-left',
2105 4 => 'Mid-right',
2106 5 => 'Upper-left',
2107 6 => 'Upper-right',
2108 7 => 'Lower-left',
2109 8 => 'Lower-right',
2110 9 => 'Far Left',
2111 10 => 'Far Right',
2112 },
2113 },
2114 },
2115);
2116
2117# Nikon AF information for D3 and D300 (ref JD)
2118%Image::ExifTool::Nikon::AFInfo2 = (
2119 %binaryDataAttrs,
2120 GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
2121 DATAMEMBER => [ 4, 6 ],
2122 NOTES => "These tags are written by Nikon DSLR's which have the live view feature.",
2123 # NOTE: Must set ByteOrder in SubDirectory if any multi-byte integer tags added
2124 0 => {
2125 Name => 'AFInfo2Version',
2126 Format => 'undef[4]',
2127 Writable => 0,
2128 },
2129 4 => { #PH
2130 Name => 'ContrastDetectAF',
2131 RawConv => '$$self{ContrastDetectAF} = $val',
2132 PrintConv => \%offOn,
2133 },
2134 5 => [
2135 {
2136 Name => 'AFAreaMode',
2137 Condition => 'not $$self{ContrastDetectAF}',
2138 Notes => 'ContrastDetectAF Off',
2139 PrintConv => {
2140 0 => 'Single Area', # (called "Single Point" in manual - PH)
2141 1 => 'Dynamic Area', #PH
2142 2 => 'Dynamic Area (closest subject)', #PH
2143 3 => 'Group Dynamic', #PH
2144 4 => 'Dynamic Area (9 points)', #JD/28
2145 5 => 'Dynamic Area (21 points)', #28
2146 6 => 'Dynamic Area (51 points)', #28
2147 7 => 'Dynamic Area (51 points, 3D-tracking)', #PH/28
2148 8 => 'Auto-area',
2149 9 => 'Dynamic Area (3D-tracking)', #PH (D5000 "3D-tracking (11 points)")
2150 10 => 'Single Area (wide)', #PH
2151 11 => 'Dynamic Area (wide)', #PH
2152 12 => 'Dynamic Area (wide, 3D-tracking)', #PH
2153 },
2154 },
2155 { #PH (D3/D90/D5000)
2156 Name => 'AFAreaMode',
2157 Notes => 'ContrastDetectAF On',
2158 PrintConv => {
2159 0 => 'Contrast-detect', # (D3)
2160 1 => 'Contrast-detect (normal area)', # (D90/D5000)
2161 # (D90 and D5000 give value of 2 when set to 'Face Priority' and
2162 # 'Subject Tracking', but I didn't have a face to shoot at or a
2163 # moving subject to track so perhaps this value changes dynamically)
2164 2 => 'Contrast-detect (wide area)', # (D90/D5000)
2165 3 => 'Contrast-detect (face priority)', # (ViewNX)
2166 4 => 'Contrast-detect (subject tracking)', # (ViewNX)
2167 },
2168 },
2169 ],
2170 6 => {
2171 Name => 'PhaseDetectAF', #JD(AutoFocus), PH(PhaseDetectAF)
2172 Notes => 'PrimaryAFPoint and AFPointsUsed below are only valid when this is On',
2173 RawConv => '$$self{PhaseDetectAF} = $val',
2174 PrintConv => {
2175 0 => 'Off',
2176 1 => 'On (51-point)', #PH
2177 2 => 'On (11-point)', #PH
2178 3 => 'On (39-point)', #29 (D7000)
2179 },
2180 },
2181 7 => [
2182 { #PH/JD
2183 Name => 'PrimaryAFPoint',
2184 Condition => '$$self{PhaseDetectAF} < 2',
2185 Notes => 'models with 51-point AF: D3, D3S, D3X, D300, D300S and D700',
2186 PrintConvColumns => 5,
2187 PrintConv => {
2188 0 => '(none)', 26 => 'C10',
2189 1 => 'C6 (Center)', 27 => 'B10',
2190 2 => 'B6', 28 => 'A9',
2191 3 => 'A5', 29 => 'D10',
2192 4 => 'D6', 30 => 'E9',
2193 5 => 'E5', 31 => 'C11',
2194 6 => 'C7', 32 => 'B11',
2195 7 => 'B7', 33 => 'D11',
2196 8 => 'A6', 34 => 'C4',
2197 9 => 'D7', 35 => 'B4',
2198 10 => 'E6', 36 => 'A3',
2199 11 => 'C5', 37 => 'D4',
2200 12 => 'B5', 38 => 'E3',
2201 13 => 'A4', 39 => 'C3',
2202 14 => 'D5', 40 => 'B3',
2203 15 => 'E4', 41 => 'A2',
2204 16 => 'C8', 42 => 'D3',
2205 17 => 'B8', 43 => 'E2',
2206 18 => 'A7', 44 => 'C2',
2207 19 => 'D8', 45 => 'B2',
2208 20 => 'E7', 46 => 'A1',
2209 21 => 'C9', 47 => 'D2',
2210 22 => 'B9', 48 => 'E1',
2211 23 => 'A8', 49 => 'C1',
2212 24 => 'D9', 50 => 'B1',
2213 25 => 'E8', 51 => 'D1',
2214 },
2215 },
2216 { #10
2217 Name => 'PrimaryAFPoint',
2218 Notes => 'models with 11-point AF: D90, D3000 and D5000',
2219 Condition => '$$self{PhaseDetectAF} == 2',
2220 PrintConvColumns => 2,
2221 PrintConv => {
2222 0 => '(none)',
2223 1 => 'Center',
2224 2 => 'Top',
2225 3 => 'Bottom',
2226 4 => 'Mid-left',
2227 5 => 'Upper-left',
2228 6 => 'Lower-left',
2229 7 => 'Far Left',
2230 8 => 'Mid-right',
2231 9 => 'Upper-right',
2232 10 => 'Lower-right',
2233 11 => 'Far Right',
2234 },
2235 },
2236 { #29
2237 Name => 'PrimaryAFPoint',
2238 Condition => '$$self{PhaseDetectAF} == 3',
2239 Notes => 'models with 39-point AF: D7000 (not verified)',
2240 PrintConvColumns => 5,
2241 PrintConv => {
2242 0 => '(none)', 22 => 'C10',
2243 1 => 'C6 (Center)', 23 => 'B10',
2244 2 => 'B6', 24 => 'D10',
2245 3 => 'A2', 25 => 'C11',
2246 4 => 'D6', 26 => 'B11',
2247 5 => 'E2', 27 => 'D11',
2248 6 => 'C7', 28 => 'C4',
2249 7 => 'B7', 29 => 'B4',
2250 8 => 'A3', 30 => 'D4',
2251 9 => 'D7', 31 => 'C3',
2252 10 => 'E3', 32 => 'B3',
2253 11 => 'C5', 33 => 'D3',
2254 12 => 'B5', 34 => 'C2',
2255 13 => 'A1', 35 => 'B2',
2256 14 => 'D5', 36 => 'D2',
2257 15 => 'E1', 37 => 'C1',
2258 16 => 'C8', 38 => 'B1',
2259 17 => 'B8', 39 => 'D1',
2260 18 => 'D8',
2261 19 => 'C9',
2262 20 => 'B9',
2263 21 => 'D9',
2264 },
2265 },
2266 {
2267 Name => 'PrimaryAFPoint',
2268 Notes => 'future models?...',
2269 PrintConv => {
2270 0 => '(none)',
2271 1 => 'Center',
2272 },
2273 },
2274 ],
2275 8 => [
2276 { #JD/PH
2277 Name => 'AFPointsUsed',
2278 Condition => '$$self{PhaseDetectAF} < 2',
2279 Notes => q{
2280 models with 51-point AF -- 5 rows: A1-9, B1-11, C1-11, D1-11, E1-9, center
2281 point is C6
2282 },
2283 Format => 'undef[7]',
2284 PrintConv => 'Image::ExifTool::Nikon::PrintAFPointsD3($val)',
2285 },
2286 { #10
2287 Name => 'AFPointsUsed',
2288 Condition => '$$self{PhaseDetectAF} == 2',
2289 Notes => 'models with 11-point AF',
2290 # read as int16u in little-endian byte order
2291 Format => 'undef[2]',
2292 ValueConv => 'unpack("v",$val)',
2293 ValueConvInv => 'pack("v",$val)',
2294 PrintConvColumns => 2,
2295 PrintConv => {
2296 0x7ff => 'All 11 Points',
2297 BITMASK => {
2298 0 => 'Center',
2299 1 => 'Top',
2300 2 => 'Bottom',
2301 3 => 'Mid-left',
2302 4 => 'Upper-left',
2303 5 => 'Lower-left',
2304 6 => 'Far Left',
2305 7 => 'Mid-right',
2306 8 => 'Upper-right',
2307 9 => 'Lower-right',
2308 10 => 'Far Right',
2309 },
2310 },
2311 },
2312 { #29
2313 Name => 'AFPointsUsed',
2314 Condition => '$$self{PhaseDetectAF} == 3',
2315 Notes => 'models with 39-point AF: D7000 (not decoded)',
2316 Format => 'undef[7]',
2317 PrintConv => '$_=unpack("H*",$val); "Unknown (".join(" ", /(..)/g).")"',
2318 },
2319 {
2320 Name => 'AFPointsUsed',
2321 Format => 'undef[7]',
2322 PrintConv => '$_=unpack("H*",$val); "Unknown (".join(" ", /(..)/g).")"',
2323 },
2324 ],
2325 0x10 => { #PH (D90 and D5000)
2326 Name => 'AFImageWidth',
2327 Format => 'int16u',
2328 RawConv => '$val ? $val : undef',
2329 Notes => 'this and the following tags are valid only for contrast-detect AF',
2330 },
2331 0x12 => { #PH
2332 Name => 'AFImageHeight',
2333 Format => 'int16u',
2334 RawConv => '$val ? $val : undef',
2335 },
2336 0x14 => { #PH
2337 Name => 'AFAreaXPosition',
2338 Notes => 'center of AF area in AFImage coordinates',
2339 Format => 'int16u',
2340 RawConv => '$val ? $val : undef',
2341 },
2342 0x16 => { #PH
2343 Name => 'AFAreaYPosition',
2344 Format => 'int16u',
2345 RawConv => '$val ? $val : undef',
2346 },
2347 # AFAreaWidth/Height for the D90 and D5000:
2348 # 352x288 (AF normal area),
2349 # 704x576 (AF face priority, wide area, subject tracking)
2350 0x18 => { #PH
2351 Name => 'AFAreaWidth',
2352 Format => 'int16u',
2353 Notes => 'size of AF area in AFImage coordinates',
2354 RawConv => '$val ? $val : undef',
2355 },
2356 0x1a => { #PH
2357 Name => 'AFAreaHeight',
2358 Format => 'int16u',
2359 RawConv => '$val ? $val : undef',
2360 },
2361 0x1c => { #PH
2362 Name => 'ContrastDetectAFInFocus',
2363 PrintConv => { 0 => 'No', 1 => 'Yes' },
2364 },
2365 # 0x1d - always zero (with or without live view)
2366);
2367
2368# Nikon AF fine-tune information (ref 28)
2369%Image::ExifTool::Nikon::AFTune = (
2370 %binaryDataAttrs,
2371 GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
2372 0 => {
2373 Name => 'AFFineTune',
2374 PrintConv => {
2375 0 => 'Off',
2376 # (don't know what the difference between 1 and 2 is)
2377 1 => 'On (1)',
2378 2 => 'On (2)',
2379 },
2380 },
2381 1 => {
2382 Name => 'AFFineTuneIndex',
2383 Notes => 'index of saved lens',
2384 PrintConv => '$val == 255 ? "n/a" : $val',
2385 PrintConvInv => '$val eq "n/a" ? 255 : $val',
2386 },
2387 2 => {
2388 Name => 'AFFineTuneAdj',
2389 Priority => 0, # so other value takes priority if it exists
2390 Notes => 'may only be valid for saved lenses',
2391 Format => 'int8s',
2392 PrintConv => '$val > 0 ? "+$val" : $val',
2393 PrintConvInv => '$val',
2394 },
2395);
2396
2397# Nikon File information - D60, D3 and D300 (ref PH)
2398%Image::ExifTool::Nikon::FileInfo = (
2399 %binaryDataAttrs,
2400 GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
2401 0 => {
2402 Name => 'FileInfoVersion',
2403 Format => 'undef[4]',
2404 Writable => 0,
2405 },
2406 6 => {
2407 Name => 'DirectoryNumber',
2408 Format => 'int16u',
2409 PrintConv => 'sprintf("%.3d", $val)',
2410 PrintConvInv => '$val',
2411 },
2412 8 => {
2413 Name => 'FileNumber',
2414 Format => 'int16u',
2415 PrintConv => 'sprintf("%.4d", $val)',
2416 PrintConvInv => '$val',
2417 },
2418);
2419
2420# ref PH
2421%Image::ExifTool::Nikon::CaptureOffsets = (
2422 PROCESS_PROC => \&ProcessNikonCaptureOffsets,
2423 GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
2424 1 => 'IFD0_Offset',
2425 2 => 'PreviewIFD_Offset',
2426 3 => 'SubIFD_Offset',
2427);
2428
2429# ref PH (Written by capture NX)
2430%Image::ExifTool::Nikon::CaptureOutput = (
2431 %binaryDataAttrs,
2432 FORMAT => 'int32u',
2433 GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
2434 # 1 = 1
2435 2 => 'OutputImageWidth',
2436 3 => 'OutputImageHeight',
2437 4 => 'OutputResolution',
2438 # 5 = 1
2439);
2440
2441# ref 4
2442%Image::ExifTool::Nikon::ColorBalanceA = (
2443 %binaryDataAttrs,
2444 FORMAT => 'int16u',
2445 GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
2446 624 => {
2447 Name => 'RedBalance',
2448 ValueConv => '$val / 256',
2449 ValueConvInv => '$val * 256',
2450 Protected => 1,
2451 },
2452 625 => {
2453 Name => 'BlueBalance',
2454 ValueConv => '$val / 256',
2455 ValueConvInv => '$val * 256',
2456 Protected => 1,
2457 },
2458);
2459
2460# ref 4
2461%Image::ExifTool::Nikon::ColorBalance1 = (
2462 %binaryDataAttrs,
2463 FORMAT => 'int16u',
2464 GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
2465 0 => {
2466 Name => 'WB_RBGGLevels',
2467 Format => 'int16u[4]',
2468 Protected => 1,
2469 },
2470);
2471
2472# ref 4
2473%Image::ExifTool::Nikon::ColorBalance2 = (
2474 %binaryDataAttrs,
2475 FORMAT => 'int16u',
2476 GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
2477 NOTES => 'This information is encrypted for most camera models.',
2478 0 => {
2479 Name => 'WB_RGGBLevels',
2480 Format => 'int16u[4]',
2481 Protected => 1,
2482 },
2483);
2484
2485# ref 4
2486%Image::ExifTool::Nikon::ColorBalance3 = (
2487 %binaryDataAttrs,
2488 FORMAT => 'int16u',
2489 GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
2490 0 => {
2491 Name => 'WB_RGBGLevels',
2492 Format => 'int16u[4]',
2493 Protected => 1,
2494 },
2495);
2496
2497# ref 4
2498%Image::ExifTool::Nikon::ColorBalance4 = (
2499 %binaryDataAttrs,
2500 FORMAT => 'int16u',
2501 GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
2502 0 => {
2503 Name => 'WB_GRBGLevels',
2504 Format => 'int16u[4]',
2505 Protected => 1,
2506 },
2507);
2508
2509%Image::ExifTool::Nikon::Type2 = (
2510 WRITE_PROC => \&Image::ExifTool::Exif::WriteExif,
2511 CHECK_PROC => \&Image::ExifTool::Exif::CheckExif,
2512 WRITABLE => 1,
2513 GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
2514 0x0003 => 'Quality',
2515 0x0004 => 'ColorMode',
2516 0x0005 => 'ImageAdjustment',
2517 0x0006 => 'CCDSensitivity',
2518 0x0007 => 'WhiteBalance',
2519 0x0008 => 'Focus',
2520 0x000A => 'DigitalZoom',
2521 0x000B => 'Converter',
2522);
2523
2524# these are standard EXIF tags, but they are duplicated here so we can
2525# set the family 0 group to 'MakerNotes' and set the MINOR_ERRORS flag
2526%Image::ExifTool::Nikon::PreviewIFD = (
2527 WRITE_PROC => \&Image::ExifTool::Exif::WriteExif,
2528 CHECK_PROC => \&Image::ExifTool::Exif::CheckExif,
2529 GROUPS => { 0 => 'MakerNotes', 1 => 'PreviewIFD', 2 => 'Image'},
2530 VARS => { MINOR_ERRORS => 1 }, # this IFD is non-essential and often corrupted
2531 # (these tags are priority 0 by default because PreviewIFD is flagged in LOW_PRIORITY_DIR)
2532 0xfe => { # (not used by Nikon, but SRW images also use this table)
2533 Name => 'SubfileType',
2534 DataMember => 'SubfileType',
2535 RawConv => '$$self{SubfileType} = $val',
2536 PrintConv => \%Image::ExifTool::Exif::subfileType,
2537 },
2538 0x103 => {
2539 Name => 'Compression',
2540 SeparateTable => 'EXIF Compression',
2541 PrintConv => \%Image::ExifTool::Exif::compression,
2542 },
2543 0x11a => 'XResolution',
2544 0x11b => 'YResolution',
2545 0x128 => {
2546 Name => 'ResolutionUnit',
2547 PrintConv => {
2548 1 => 'None',
2549 2 => 'inches',
2550 3 => 'cm',
2551 },
2552 },
2553 0x201 => {
2554 Name => 'PreviewImageStart',
2555 Flags => [ 'IsOffset', 'Permanent' ],
2556 OffsetPair => 0x202,
2557 DataTag => 'PreviewImage',
2558 Writable => 'int32u',
2559 Protected => 2,
2560 },
2561 0x202 => {
2562 Name => 'PreviewImageLength',
2563 Flags => 'Permanent' ,
2564 OffsetPair => 0x201,
2565 DataTag => 'PreviewImage',
2566 Writable => 'int32u',
2567 Protected => 2,
2568 },
2569 0x213 => {
2570 Name => 'YCbCrPositioning',
2571 PrintConv => {
2572 1 => 'Centered',
2573 2 => 'Co-sited',
2574 },
2575 },
2576);
2577
2578# these are duplicated enough times to make it worthwhile to define them centrally
2579my %nikonApertureConversions = (
2580 ValueConv => '2**($val/24)',
2581 ValueConvInv => '$val>0 ? 24*log($val)/log(2) : 0',
2582 PrintConv => 'sprintf("%.1f",$val)',
2583 PrintConvInv => '$val',
2584);
2585
2586my %nikonFocalConversions = (
2587 ValueConv => '5 * 2**($val/24)',
2588 ValueConvInv => '$val>0 ? 24*log($val/5)/log(2) : 0',
2589 PrintConv => 'sprintf("%.1f mm",$val)',
2590 PrintConvInv => '$val=~s/\s*mm$//;$val',
2591);
2592
2593# Version 100 Nikon lens data
2594%Image::ExifTool::Nikon::LensData00 = (
2595 %binaryDataAttrs,
2596 NOTES => 'This structure is used by the D100, and D1X with firmware version 1.1.',
2597 GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
2598 # NOTE: Must set ByteOrder in SubDirectory if any multi-byte integer tags added
2599 0x00 => {
2600 Name => 'LensDataVersion',
2601 Format => 'undef[4]',
2602 Writable => 0,
2603 },
2604 0x06 => { #8
2605 Name => 'LensIDNumber',
2606 Notes => 'see LensID values below',
2607 },
2608 0x07 => { #8
2609 Name => 'LensFStops',
2610 ValueConv => '$val / 12',
2611 ValueConvInv => '$val * 12',
2612 PrintConv => 'sprintf("%.2f", $val)',
2613 PrintConvInv => '$val',
2614 },
2615 0x08 => { #8/9
2616 Name => 'MinFocalLength',
2617 %nikonFocalConversions,
2618 },
2619 0x09 => { #8/9
2620 Name => 'MaxFocalLength',
2621 %nikonFocalConversions,
2622 },
2623 0x0a => { #8
2624 Name => 'MaxApertureAtMinFocal',
2625 %nikonApertureConversions,
2626 },
2627 0x0b => { #8
2628 Name => 'MaxApertureAtMaxFocal',
2629 %nikonApertureConversions,
2630 },
2631 0x0c => 'MCUVersion', #8
2632);
2633
2634# Nikon lens data (note: needs decrypting if LensDataVersion is 020x)
2635%Image::ExifTool::Nikon::LensData01 = (
2636 %binaryDataAttrs,
2637 NOTES => q{
2638 Nikon encrypts the LensData information below if LensDataVersion is 0201 or
2639 higher, but the decryption algorithm is known so the information can be
2640 extracted.
2641 },
2642 GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
2643 # NOTE: Must set ByteOrder in SubDirectory if any multi-byte integer tags added
2644 0x00 => {
2645 Name => 'LensDataVersion',
2646 Format => 'string[4]',
2647 Writable => 0,
2648 },
2649 0x04 => { #8
2650 Name => 'ExitPupilPosition',
2651 ValueConv => '$val ? 2048 / $val : $val',
2652 ValueConvInv => '$val ? 2048 / $val : $val',
2653 PrintConv => 'sprintf("%.1f mm",$val)',
2654 PrintConvInv => '$val=~s/\s*mm$//; $val',
2655 },
2656 0x05 => { #8
2657 Name => 'AFAperture',
2658 %nikonApertureConversions,
2659 },
2660 0x08 => { #8
2661 # this seems to be 2 values: the upper nibble gives the far focus
2662 # range and the lower nibble gives the near focus range. The values
2663 # are in the range 1-N, where N is lens-dependent. A value of 0 for
2664 # the far focus range indicates infinity. (ref JD)
2665 Name => 'FocusPosition',
2666 PrintConv => 'sprintf("0x%02x", $val)',
2667 PrintConvInv => '$val',
2668 },
2669 0x09 => { #8/9
2670 # With older AF lenses this does not work... (ref 13)
2671 # ie) AF Nikkor 50mm f/1.4 => 48 (0x30)
2672 # AF Zoom-Nikkor 35-105mm f/3.5-4.5 => @35mm => 15 (0x0f), @105mm => 141 (0x8d)
2673 Notes => 'this focus distance is approximate, and not very accurate for some lenses',
2674 Name => 'FocusDistance',
2675 ValueConv => '0.01 * 10**($val/40)', # in m
2676 ValueConvInv => '$val>0 ? 40*log($val*100)/log(10) : 0',
2677 PrintConv => '$val ? sprintf("%.2f m",$val) : "inf"',
2678 PrintConvInv => '$val eq "inf" ? 0 : $val =~ s/\s*m$//, $val',
2679 },
2680 0x0a => { #8/9
2681 Name => 'FocalLength',
2682 Priority => 0,
2683 %nikonFocalConversions,
2684 },
2685 0x0b => { #8
2686 Name => 'LensIDNumber',
2687 Notes => 'see LensID values below',
2688 },
2689 0x0c => { #8
2690 Name => 'LensFStops',
2691 ValueConv => '$val / 12',
2692 ValueConvInv => '$val * 12',
2693 PrintConv => 'sprintf("%.2f", $val)',
2694 PrintConvInv => '$val',
2695 },
2696 0x0d => { #8/9
2697 Name => 'MinFocalLength',
2698 %nikonFocalConversions,
2699 },
2700 0x0e => { #8/9
2701 Name => 'MaxFocalLength',
2702 %nikonFocalConversions,
2703 },
2704 0x0f => { #8
2705 Name => 'MaxApertureAtMinFocal',
2706 %nikonApertureConversions,
2707 },
2708 0x10 => { #8
2709 Name => 'MaxApertureAtMaxFocal',
2710 %nikonApertureConversions,
2711 },
2712 0x11 => 'MCUVersion', #8
2713 0x12 => { #8
2714 Name => 'EffectiveMaxAperture',
2715 %nikonApertureConversions,
2716 },
2717);
2718
2719# Nikon lens data (note: needs decrypting)
2720%Image::ExifTool::Nikon::LensData0204 = (
2721 %binaryDataAttrs,
2722 NOTES => q{
2723 Nikon encrypts the LensData information below if LensDataVersion is 0201 or
2724 higher, but the decryption algorithm is known so the information can be
2725 extracted.
2726 },
2727 GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
2728 # NOTE: Must set ByteOrder in SubDirectory if any multi-byte integer tags added
2729 0x00 => {
2730 Name => 'LensDataVersion',
2731 Format => 'string[4]',
2732 Writable => 0,
2733 },
2734 0x04 => { #8
2735 Name => 'ExitPupilPosition',
2736 ValueConv => '$val ? 2048 / $val : $val',
2737 ValueConvInv => '$val ? 2048 / $val : $val',
2738 PrintConv => 'sprintf("%.1f mm",$val)',
2739 PrintConvInv => '$val=~s/\s*mm$//; $val',
2740 },
2741 0x05 => { #8
2742 Name => 'AFAperture',
2743 %nikonApertureConversions,
2744 },
2745 0x08 => { #8
2746 # this seems to be 2 values: the upper nibble gives the far focus
2747 # range and the lower nibble gives the near focus range. The values
2748 # are in the range 1-N, where N is lens-dependent. A value of 0 for
2749 # the far focus range indicates infinity. (ref JD)
2750 Name => 'FocusPosition',
2751 PrintConv => 'sprintf("0x%02x", $val)',
2752 PrintConvInv => '$val',
2753 },
2754 # --> extra byte at position 0x09 in this version of LensData (PH)
2755 0x0a => { #8/9
2756 # With older AF lenses this does not work... (ref 13)
2757 # ie) AF Nikkor 50mm f/1.4 => 48 (0x30)
2758 # AF Zoom-Nikkor 35-105mm f/3.5-4.5 => @35mm => 15 (0x0f), @105mm => 141 (0x8d)
2759 Notes => 'this focus distance is approximate, and not very accurate for some lenses',
2760 Name => 'FocusDistance',
2761 ValueConv => '0.01 * 10**($val/40)', # in m
2762 ValueConvInv => '$val>0 ? 40*log($val*100)/log(10) : 0',
2763 PrintConv => '$val ? sprintf("%.2f m",$val) : "inf"',
2764 PrintConvInv => '$val eq "inf" ? 0 : $val =~ s/\s*m$//, $val',
2765 },
2766 0x0b => { #8/9
2767 Name => 'FocalLength',
2768 Priority => 0,
2769 %nikonFocalConversions,
2770 },
2771 0x0c => { #8
2772 Name => 'LensIDNumber',
2773 Notes => 'see LensID values below',
2774 },
2775 0x0d => { #8
2776 Name => 'LensFStops',
2777 ValueConv => '$val / 12',
2778 ValueConvInv => '$val * 12',
2779 PrintConv => 'sprintf("%.2f", $val)',
2780 PrintConvInv => '$val',
2781 },
2782 0x0e => { #8/9
2783 Name => 'MinFocalLength',
2784 %nikonFocalConversions,
2785 },
2786 0x0f => { #8/9
2787 Name => 'MaxFocalLength',
2788 %nikonFocalConversions,
2789 },
2790 0x10 => { #8
2791 Name => 'MaxApertureAtMinFocal',
2792 %nikonApertureConversions,
2793 },
2794 0x11 => { #8
2795 Name => 'MaxApertureAtMaxFocal',
2796 %nikonApertureConversions,
2797 },
2798 0x12 => 'MCUVersion', #8
2799 0x13 => { #8
2800 Name => 'EffectiveMaxAperture',
2801 %nikonApertureConversions,
2802 },
2803);
2804
2805# Unknown Nikon lens data (note: data may need decrypting after byte 4)
2806%Image::ExifTool::Nikon::LensDataUnknown = (
2807 PROCESS_PROC => \&Image::ExifTool::ProcessBinaryData,
2808 FIRST_ENTRY => 0,
2809 GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
2810 0x00 => {
2811 Name => 'LensDataVersion',
2812 Format => 'string[4]',
2813 },
2814);
2815
2816# shot information (encrypted in some cameras) - ref 18
2817%Image::ExifTool::Nikon::ShotInfo = (
2818 %binaryDataAttrs,
2819 GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
2820 DATAMEMBER => [ 0 ],
2821 NOTES => q{
2822 This information is encrypted for ShotInfoVersion 02xx, and some tags are
2823 only valid for specific models.
2824 },
2825 0x00 => {
2826 Name => 'ShotInfoVersion',
2827 Format => 'string[4]',
2828 Writable => 0,
2829 RawConv => '$$self{ShotInfoVersion} = $val; $val =~ /^\d+$/ ? $val : undef',
2830 },
2831 0x04 => {
2832 Name => 'FirmwareVersion',
2833 Format => 'string[5]',
2834 Writable => 0,
2835 RawConv => '$val =~ /^\d\.\d+.$/ ? $val : undef',
2836 },
2837 0x10 => {
2838 Name => 'DistortionControl',
2839 Condition => '$$self{Model} =~ /P6000\b/',
2840 Notes => 'P6000',
2841 PrintConv => \%offOn,
2842 },
2843 0x66 => {
2844 Name => 'VR_0x66',
2845 Condition => '$$self{ShotInfoVersion} eq "0204"',
2846 Format => 'int8u',
2847 Unknown => 1,
2848 Notes => 'D2X, D2Xs (unverified)',
2849 PrintConv => {
2850 0 => 'Off',
2851 1 => 'On (normal)',
2852 2 => 'On (active)',
2853 },
2854 },
2855 # 6a, 6e not correct for 0103 (D70), 0207 (D200)
2856 0x6a => {
2857 Name => 'ShutterCount',
2858 Condition => '$$self{ShotInfoVersion} eq "0204"',
2859 Format => 'int32u',
2860 Priority => 0,
2861 Notes => 'D2X, D2Xs',
2862 },
2863 0x6e => {
2864 Name => 'DeletedImageCount',
2865 Condition => '$$self{ShotInfoVersion} eq "0204"',
2866 Format => 'int32u',
2867 Priority => 0,
2868 Notes => 'D2X, D2Xs',
2869 },
2870 0x75 => { #JD
2871 Name => 'VibrationReduction',
2872 Condition => '$$self{ShotInfoVersion} eq "0207"',
2873 Format => 'int8u',
2874 Notes => 'D200',
2875 PrintConv => {
2876 0 => 'Off',
2877 # (not sure what the different values represent, but values
2878 # of 1 and 2 have even been observed for non-VR lenses!)
2879 1 => 'On (1)', #PH
2880 2 => 'On (2)', #PH
2881 3 => 'On (3)', #PH (rare -- only seen once)
2882 },
2883 },
2884 0x82 => { # educated guess, needs verification
2885 Name => 'VibrationReduction',
2886 Condition => '$$self{ShotInfoVersion} eq "0204"',
2887 Format => 'int8u',
2888 Notes => 'D2X, D2Xs',
2889 PrintConv => {
2890 0 => 'Off',
2891 1 => 'On',
2892 },
2893 },
2894 0x157 => { #JD
2895 Name => 'ShutterCount',
2896 Condition => '$$self{ShotInfoVersion} eq "0205"',
2897 Format => 'undef[2]',
2898 Priority => 0,
2899 Notes => 'D50',
2900 # treat as a 2-byte big-endian integer
2901 ValueConv => 'unpack("n", $val)',
2902 ValueConvInv => 'pack("n",$val)',
2903 },
2904 0x1ae => { #JD
2905 Name => 'VibrationReduction',
2906 Condition => '$$self{ShotInfoVersion} eq "0205"',
2907 Format => 'int8u',
2908 Notes => 'D50',
2909 PrintHex => 1,
2910 PrintConv => {
2911 0x00 => 'n/a',
2912 0x0c => 'Off',
2913 0x0f => 'On',
2914 },
2915 },
2916 0x24d => { #PH
2917 Name => 'ShutterCount',
2918 Condition => '$$self{ShotInfoVersion} eq "0211"',
2919 Notes => 'D60',
2920 Format => 'int32u',
2921 Priority => 0,
2922 },
2923 # note: DecryptLen currently set to 0x251
2924);
2925
2926# shot information for D40 and D40X (encrypted) - ref PH
2927%Image::ExifTool::Nikon::ShotInfoD40 = (
2928 PROCESS_PROC => \&Image::ExifTool::Nikon::ProcessNikonEncrypted,
2929 WRITE_PROC => \&Image::ExifTool::Nikon::ProcessNikonEncrypted,
2930 CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
2931 VARS => { ID_LABEL => 'Index' },
2932 IS_SUBDIR => [ 729 ],
2933 WRITABLE => 1,
2934 FIRST_ENTRY => 0,
2935 GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
2936 NOTES => 'These tags are extracted from encrypted data in D40 and D40X images.',
2937 0x00 => {
2938 Name => 'ShotInfoVersion',
2939 Format => 'string[4]',
2940 Writable => 0,
2941 },
2942 582 => {
2943 Name => 'ShutterCount',
2944 Format => 'int32u',
2945 Priority => 0,
2946 },
2947 586.1 => { #JD
2948 Name => 'VibrationReduction',
2949 Mask => 0x08,
2950 PrintConv => {
2951 0x00 => 'Off',
2952 0x08 => 'On',
2953 },
2954 },
2955 729 => { #JD
2956 Name => 'CustomSettingsD40',
2957 Format => 'undef[12]',
2958 SubDirectory => {
2959 TagTable => 'Image::ExifTool::NikonCustom::SettingsD40',
2960 },
2961 },
2962 # note: DecryptLen currently set to 748
2963);
2964
2965# shot information for D80 (encrypted) - ref JD
2966%Image::ExifTool::Nikon::ShotInfoD80 = (
2967 PROCESS_PROC => \&Image::ExifTool::Nikon::ProcessNikonEncrypted,
2968 WRITE_PROC => \&Image::ExifTool::Nikon::ProcessNikonEncrypted,
2969 CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
2970 VARS => { ID_LABEL => 'Index' },
2971 IS_SUBDIR => [ 748 ],
2972 WRITABLE => 1,
2973 FIRST_ENTRY => 0,
2974 GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
2975 NOTES => 'These tags are extracted from encrypted data in D80 images.',
2976 0x00 => {
2977 Name => 'ShotInfoVersion',
2978 Format => 'string[4]',
2979 Writable => 0,
2980 },
2981 586 => {
2982 Name => 'ShutterCount',
2983 Format => 'int32u',
2984 Priority => 0,
2985 },
2986 # split 590 into a few different tags
2987 590.1 => {
2988 Name => 'Rotation',
2989 Mask => 0x07,
2990 PrintConv => {
2991 0x00 => 'Horizontal',
2992 0x01 => 'Rotated 270 CW',
2993 0x02 => 'Rotated 90 CW',
2994 0x03 => 'Rotated 180',
2995 },
2996 },
2997 590.2 => {
2998 Name => 'VibrationReduction',
2999 Mask => 0x18,
3000 PrintConv => {
3001 0x00 => 'Off',
3002 0x18 => 'On',
3003 },
3004 },
3005 590.3 => {
3006 Name => 'FlashFired',
3007 Mask => 0xe0,
3008 PrintConv => { BITMASK => {
3009 6 => 'Internal',
3010 7 => 'External',
3011 }},
3012 },
3013 708 => {
3014 Name => 'NikonImageSize',
3015 Mask => 0xf0,
3016 PrintConv => {
3017 0x00 => 'Large (10.0 M)',
3018 0x10 => 'Medium (5.6 M)',
3019 0x20 => 'Small (2.5 M)',
3020 },
3021 },
3022 708.1 => {
3023 Name => 'ImageQuality',
3024 Mask => 0x0f,
3025 PrintConv => {
3026 0 => 'NEF (RAW)',
3027 1 => 'JPEG Fine',
3028 2 => 'JPEG Normal',
3029 3 => 'JPEG Basic',
3030 4 => 'NEF (RAW) + JPEG Fine',
3031 5 => 'NEF (RAW) + JPEG Normal',
3032 6 => 'NEF (RAW) + JPEG Basic',
3033 },
3034 },
3035 748 => { #JD
3036 Name => 'CustomSettingsD80',
3037 Format => 'undef[17]',
3038 SubDirectory => {
3039 TagTable => 'Image::ExifTool::NikonCustom::SettingsD80',
3040 },
3041 },
3042 # note: DecryptLen currently set to 764
3043);
3044
3045# shot information for D90 (encrypted) - ref PH
3046%Image::ExifTool::Nikon::ShotInfoD90 = (
3047 PROCESS_PROC => \&Image::ExifTool::Nikon::ProcessNikonEncrypted,
3048 WRITE_PROC => \&Image::ExifTool::Nikon::ProcessNikonEncrypted,
3049 CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
3050 VARS => { ID_LABEL => 'Index' },
3051 IS_SUBDIR => [ 0x374 ],
3052 WRITABLE => 1,
3053 FIRST_ENTRY => 0,
3054 GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
3055 NOTES => q{
3056 These tags are extracted from encrypted data in images from the D90 with
3057 firmware 1.00.
3058 },
3059 0x00 => {
3060 Name => 'ShotInfoVersion',
3061 Format => 'string[4]',
3062 Writable => 0,
3063 },
3064 0x04 => {
3065 Name => 'FirmwareVersion',
3066 Format => 'string[5]',
3067 Writable => 0,
3068 },
3069 0x2b5 => { #JD (same value found at offset 0x39, 0x2bf, 0x346)
3070 Name => 'ISO2',
3071 ValueConv => '100*exp(($val/12-5)*log(2))',
3072 ValueConvInv => '(log($val/100)/log(2)+5)*12',
3073 PrintConv => 'int($val + 0.5)',
3074 PrintConvInv => '$val',
3075 },
3076 0x2d5 => {
3077 Name => 'ShutterCount',
3078 Format => 'int32u',
3079 Priority => 0,
3080 },
3081 0x374 => {
3082 Name => 'CustomSettingsD90',
3083 Format => 'undef[36]',
3084 SubDirectory => {
3085 TagTable => 'Image::ExifTool::NikonCustom::SettingsD90',
3086 },
3087 },
3088 # note: DecryptLen currently set to 0x398
3089);
3090
3091# shot information for the D3 firmware 0.37 and 1.00 (encrypted) - ref PH
3092%Image::ExifTool::Nikon::ShotInfoD3a = (
3093 PROCESS_PROC => \&Image::ExifTool::Nikon::ProcessNikonEncrypted,
3094 WRITE_PROC => \&Image::ExifTool::Nikon::ProcessNikonEncrypted,
3095 CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
3096 VARS => { ID_LABEL => 'Index' },
3097 IS_SUBDIR => [ 0x301 ],
3098 WRITABLE => 1,
3099 FIRST_ENTRY => 0,
3100 GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
3101 NOTES => q{
3102 These tags are extracted from encrypted data in images from the D3 with
3103 firmware 1.00 and earlier.
3104 },
3105 0x00 => {
3106 Name => 'ShotInfoVersion',
3107 Format => 'string[4]',
3108 Writable => 0,
3109 },
3110 0x256 => { #JD (same value found at offset 0x26b)
3111 Name => 'ISO2',
3112 ValueConv => '100*exp(($val/12-5)*log(2))',
3113 ValueConvInv => '(log($val/100)/log(2)+5)*12',
3114 PrintConv => 'int($val + 0.5)',
3115 PrintConvInv => '$val',
3116 },
3117 0x276 => { #JD
3118 Name => 'ShutterCount',
3119 Format => 'int32u',
3120 Priority => 0,
3121 },
3122 723.1 => {
3123 Name => 'NikonImageSize',
3124 Mask => 0x18,
3125 PrintConv => {
3126 0x00 => 'Large',
3127 0x08 => 'Medium',
3128 0x10 => 'Small',
3129 },
3130 },
3131 723.2 => {
3132 Name => 'ImageQuality',
3133 Mask => 0x07,
3134 PrintConv => {
3135 0 => 'NEF (RAW) + JPEG Fine',
3136 1 => 'NEF (RAW) + JPEG Norm',
3137 2 => 'NEF (RAW) + JPEG Basic',
3138 3 => 'NEF (RAW)',
3139 4 => 'TIF (RGB)',
3140 5 => 'JPEG Fine',
3141 6 => 'JPEG Normal',
3142 7 => 'JPEG Basic',
3143 },
3144 },
3145 0x301 => { #(NC)
3146 Name => 'CustomSettingsD3',
3147 Format => 'undef[24]',
3148 SubDirectory => {
3149 TagTable => 'Image::ExifTool::NikonCustom::SettingsD3',
3150 },
3151 },
3152 # note: DecryptLen currently set to 0x318
3153);
3154
3155# shot information for the D3 firmware 1.10, 2.00 and 2.01 (encrypted) - ref PH
3156%Image::ExifTool::Nikon::ShotInfoD3b = (
3157 PROCESS_PROC => \&Image::ExifTool::Nikon::ProcessNikonEncrypted,
3158 WRITE_PROC => \&Image::ExifTool::Nikon::ProcessNikonEncrypted,
3159 CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
3160 VARS => { ID_LABEL => 'Index' },
3161 IS_SUBDIR => [ 0x30a ],
3162 WRITABLE => 1,
3163 FIRST_ENTRY => 0,
3164 GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
3165 DATAMEMBER => [ 4 ],
3166 NOTES => q{
3167 These tags are extracted from encrypted data in images from the D3 with
3168 firmware 1.10, 2.00, 2.01 and 2.02.
3169 },
3170 0x00 => {
3171 Name => 'ShotInfoVersion',
3172 Format => 'string[4]',
3173 Writable => 0,
3174 },
3175 0x04 => {
3176 Name => 'FirmwareVersion',
3177 Format => 'string[5]',
3178 Writable => 0,
3179 RawConv => '$$self{FirmwareVersion} = $val',
3180 },
3181 0x10 => { #28
3182 Name => 'ImageArea',
3183 PrintConv => {
3184 0 => 'FX (36.0 x 23.9 mm)',
3185 1 => 'DX (23.5 x 15.6 mm)',
3186 2 => '5:4 (30.0 x 23.9 mm)',
3187 },
3188 },
3189 0x25d => {
3190 Name => 'ISO2',
3191 ValueConv => '100*exp(($val/12-5)*log(2))',
3192 ValueConvInv => '(log($val/100)/log(2)+5)*12',
3193 PrintConv => 'int($val + 0.5)',
3194 PrintConvInv => '$val',
3195 },
3196 0x27d => {
3197 Name => 'ShutterCount',
3198 Condition => '$$self{FirmwareVersion} =~ /^1.01/',
3199 Notes => 'firmware 1.10',
3200 Format => 'int32u',
3201 Priority => 0,
3202 },
3203 0x27f => {
3204 Name => 'ShutterCount',
3205 Condition => '$$self{FirmwareVersion} =~ /^2.0[012]/',
3206 Notes => 'firmware 2.00, 2.01 and 2.02',
3207 Format => 'int32u',
3208 Priority => 0,
3209 },
3210 732.1 => { #28
3211 Name => 'NikonImageSize',
3212 Mask => 0x18,
3213 PrintConv => {
3214 0x00 => 'Large',
3215 0x08 => 'Medium',
3216 0x10 => 'Small',
3217 },
3218 },
3219 732.2 => { #28
3220 Name => 'ImageQuality',
3221 Mask => 0x07,
3222 PrintConv => {
3223 0 => 'NEF (RAW) + JPEG Fine',
3224 1 => 'NEF (RAW) + JPEG Norm',
3225 2 => 'NEF (RAW) + JPEG Basic',
3226 3 => 'NEF (RAW)',
3227 4 => 'TIF (RGB)',
3228 5 => 'JPEG Fine',
3229 6 => 'JPEG Normal',
3230 7 => 'JPEG Basic',
3231 },
3232 },
3233 0x28a => { #28
3234 Name => 'PreFlashReturnStrength',
3235 Notes => 'valid in TTL and TTL-BL flash control modes',
3236 # this is used to set the flash power using this relationship
3237 # for the SB-800 and SB-900:
3238 # $val < 140 ? 2**(0.08372*$val-12.352) : $val
3239 },
3240 0x30a => { # tested with firmware 2.00
3241 Name => 'CustomSettingsD3',
3242 Format => 'undef[24]',
3243 SubDirectory => {
3244 TagTable => 'Image::ExifTool::NikonCustom::SettingsD3',
3245 },
3246 },
3247 # note: DecryptLen currently set to 0x321
3248);
3249
3250# shot information for the D3X firmware 1.00 (encrypted) - ref PH
3251%Image::ExifTool::Nikon::ShotInfoD3X = (
3252 PROCESS_PROC => \&Image::ExifTool::Nikon::ProcessNikonEncrypted,
3253 WRITE_PROC => \&Image::ExifTool::Nikon::ProcessNikonEncrypted,
3254 CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
3255 VARS => { ID_LABEL => 'Index' },
3256 IS_SUBDIR => [ 0x30b ],
3257 WRITABLE => 1,
3258 FIRST_ENTRY => 0,
3259 GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
3260 NOTES => q{
3261 These tags are extracted from encrypted data in images from the D3X with
3262 firmware 1.00.
3263 },
3264 0x00 => {
3265 Name => 'ShotInfoVersion',
3266 Format => 'string[4]',
3267 Writable => 0,
3268 },
3269 0x04 => {
3270 Name => 'FirmwareVersion',
3271 Format => 'string[5]',
3272 Writable => 0,
3273 },
3274 0x25d => {
3275 Name => 'ISO2',
3276 ValueConv => '100*exp(($val/12-5)*log(2))',
3277 ValueConvInv => '(log($val/100)/log(2)+5)*12',
3278 PrintConv => 'int($val + 0.5)',
3279 PrintConvInv => '$val',
3280 },
3281 0x280 => {
3282 Name => 'ShutterCount',
3283 Format => 'int32u',
3284 Priority => 0,
3285 },
3286 0x30b => { #(NC)
3287 Name => 'CustomSettingsD3X',
3288 Format => 'undef[24]',
3289 SubDirectory => {
3290 TagTable => 'Image::ExifTool::NikonCustom::SettingsD3',
3291 },
3292 },
3293 # note: DecryptLen currently set to 0x323
3294);
3295
3296# shot information for the D3S firmware 0.16 and 1.00 (encrypted) - ref PH
3297%Image::ExifTool::Nikon::ShotInfoD3S = (
3298 PROCESS_PROC => \&Image::ExifTool::Nikon::ProcessNikonEncrypted,
3299 WRITE_PROC => \&Image::ExifTool::Nikon::ProcessNikonEncrypted,
3300 CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
3301 VARS => { ID_LABEL => 'Index' },
3302 IS_SUBDIR => [ 0x2ce ],
3303 WRITABLE => 1,
3304 FIRST_ENTRY => 0,
3305 GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
3306 NOTES => q{
3307 These tags are extracted from encrypted data in images from the D3S with
3308 firmware 1.00 and earlier.
3309 },
3310 0x00 => {
3311 Name => 'ShotInfoVersion',
3312 Format => 'string[4]',
3313 Writable => 0,
3314 },
3315 0x04 => {
3316 Name => 'FirmwareVersion',
3317 Format => 'string[5]',
3318 Writable => 0,
3319 },
3320 0x10 => { #28
3321 Name => 'ImageArea',
3322 PrintConv => {
3323 0 => 'FX (36x24)',
3324 1 => 'DX (24x16)',
3325 2 => '5:4 (30x24)',
3326 3 => '1.2x (30x20)',
3327 },
3328 },
3329 0x221 => {
3330 Name => 'ISO2',
3331 ValueConv => '100*exp(($val/12-5)*log(2))',
3332 ValueConvInv => '(log($val/100)/log(2)+5)*12',
3333 PrintConv => 'int($val + 0.5)',
3334 PrintConvInv => '$val',
3335 },
3336 0x242 => {
3337 Name => 'ShutterCount',
3338 Format => 'int32u',
3339 Priority => 0,
3340 },
3341 0x2ce => { #(NC)
3342 Name => 'CustomSettingsD3S',
3343 Format => 'undef[24]',
3344 SubDirectory => {
3345 TagTable => 'Image::ExifTool::NikonCustom::SettingsD3',
3346 },
3347 },
3348 # note: DecryptLen currently set to 0x2e6
3349);
3350
3351# shot information for the D300 firmware 1.00 (encrypted) - ref JD
3352%Image::ExifTool::Nikon::ShotInfoD300a = (
3353 PROCESS_PROC => \&Image::ExifTool::Nikon::ProcessNikonEncrypted,
3354 WRITE_PROC => \&Image::ExifTool::Nikon::ProcessNikonEncrypted,
3355 CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
3356 VARS => { ID_LABEL => 'Index' },
3357 IS_SUBDIR => [ 790 ],
3358 WRITABLE => 1,
3359 FIRST_ENTRY => 0,
3360 GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
3361 NOTES => q{
3362 These tags are extracted from encrypted data in images from the D300 with
3363 firmware 1.00 and earlier.
3364 },
3365 0x00 => {
3366 Name => 'ShotInfoVersion',
3367 Format => 'string[4]',
3368 Writable => 0,
3369 },
3370 604 => {
3371 Name => 'ISO2',
3372 ValueConv => '100*exp(($val/12-5)*log(2))',
3373 ValueConvInv => '(log($val/100)/log(2)+5)*12',
3374 PrintConv => 'int($val + 0.5)',
3375 PrintConvInv => '$val',
3376 },
3377 633 => {
3378 Name => 'ShutterCount',
3379 Format => 'int32u',
3380 Priority => 0,
3381 },
3382 721 => { #PH
3383 Name => 'AFFineTuneAdj',
3384 Format => 'int16u',
3385 PrintHex => 1,
3386 PrintConvColumns => 3,
3387 # thanks to Neil Nappe for the samples to decode this!...
3388 # (have seen various unknown values here when flash is enabled, but
3389 # these are yet to be decoded: 0x2e,0x619,0xd0d,0x103a,0x2029 - PH)
3390 PrintConv => {
3391 0x403e => '+20',
3392 0x303e => '+19',
3393 0x203e => '+18',
3394 0x103e => '+17',
3395 0x003e => '+16',
3396 0xe03d => '+15',
3397 0xc03d => '+14',
3398 0xa03d => '+13',
3399 0x803d => '+12',
3400 0x603d => '+11',
3401 0x403d => '+10',
3402 0x203d => '+9',
3403 0x003d => '+8',
3404 0xc03c => '+7',
3405 0x803c => '+6',
3406 0x403c => '+5',
3407 0x003c => '+4',
3408 0x803b => '+3',
3409 0x003b => '+2',
3410 0x003a => '+1',
3411 0x0000 => '0',
3412 0x00c6 => '-1',
3413 0x00c5 => '-2',
3414 0x80c5 => '-3',
3415 0x00c4 => '-4',
3416 0x40c4 => '-5',
3417 0x80c4 => '-6',
3418 0xc0c4 => '-7',
3419 0x00c3 => '-8',
3420 0x20c3 => '-9',
3421 0x40c3 => '-10',
3422 0x60c3 => '-11',
3423 0x80c3 => '-12',
3424 0xa0c3 => '-13',
3425 0xc0c3 => '-14',
3426 0xe0c3 => '-15',
3427 0x00c2 => '-16',
3428 0x10c2 => '-17',
3429 0x20c2 => '-18',
3430 0x30c2 => '-19',
3431 0x40c2 => '-20',
3432 },
3433 },
3434 790 => {
3435 Name => 'CustomSettingsD300',
3436 Format => 'undef[24]',
3437 SubDirectory => {
3438 TagTable => 'Image::ExifTool::NikonCustom::SettingsD3',
3439 },
3440 },
3441 # note: DecryptLen currently set to 813
3442);
3443
3444# shot information for the D300 firmware 1.10 (encrypted) - ref PH
3445%Image::ExifTool::Nikon::ShotInfoD300b = (
3446 PROCESS_PROC => \&Image::ExifTool::Nikon::ProcessNikonEncrypted,
3447 WRITE_PROC => \&Image::ExifTool::Nikon::ProcessNikonEncrypted,
3448 CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
3449 VARS => { ID_LABEL => 'Index' },
3450 IS_SUBDIR => [ 802 ],
3451 WRITABLE => 1,
3452 FIRST_ENTRY => 0,
3453 GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
3454 NOTES => q{
3455 These tags are extracted from encrypted data in images from the D300 with
3456 firmware 1.10.
3457 },
3458 0x00 => {
3459 Name => 'ShotInfoVersion',
3460 Format => 'string[4]',
3461 Writable => 0,
3462 },
3463 0x04 => { #PH
3464 Name => 'FirmwareVersion',
3465 Format => 'string[5]',
3466 Writable => 0,
3467 },
3468 613 => {
3469 Name => 'ISO2',
3470 ValueConv => '100*exp(($val/12-5)*log(2))',
3471 ValueConvInv => '(log($val/100)/log(2)+5)*12',
3472 PrintConv => 'int($val + 0.5)',
3473 PrintConvInv => '$val',
3474 },
3475 644 => {
3476 Name => 'ShutterCount',
3477 Format => 'int32u',
3478 Priority => 0,
3479 },
3480 732 => {
3481 Name => 'AFFineTuneAdj',
3482 Format => 'int16u',
3483 PrintHex => 1,
3484 PrintConvColumns => 3,
3485 # thanks to Stuart Solomon for the samples to decode this!...
3486 PrintConv => {
3487 0x903e => '+20',
3488 0x7c3e => '+19',
3489 0x683e => '+18',
3490 0x543e => '+17',
3491 0x403e => '+16',
3492 0x2c3e => '+15',
3493 0x183e => '+14',
3494 0x043e => '+13',
3495 0xe03d => '+12',
3496 0xb83d => '+11',
3497 0x903d => '+10',
3498 0x683d => '+9',
3499 0x403d => '+8',
3500 0x183d => '+7',
3501 0xe03c => '+6',
3502 0x903c => '+5',
3503 0x403c => '+4',
3504 0xe03b => '+3',
3505 0x403b => '+2',
3506 0x403a => '+1',
3507 0x0000 => '0',
3508 0x40c6 => '-1',
3509 0x40c5 => '-2',
3510 0xe0c5 => '-3',
3511 0x40c4 => '-4',
3512 0x90c4 => '-5',
3513 0xe0c4 => '-6',
3514 0x18c3 => '-7',
3515 0x40c3 => '-8',
3516 0x68c3 => '-9',
3517 0x90c3 => '-10',
3518 0xb8c3 => '-11',
3519 0xe0c3 => '-12',
3520 0x04c2 => '-13',
3521 0x18c2 => '-14',
3522 0x2cc2 => '-15',
3523 0x40c2 => '-16',
3524 0x54c2 => '-17',
3525 0x68c2 => '-18',
3526 0x7cc2 => '-19',
3527 0x90c2 => '-20',
3528 },
3529 },
3530 802 => {
3531 Name => 'CustomSettingsD300',
3532 Format => 'undef[24]',
3533 SubDirectory => {
3534 TagTable => 'Image::ExifTool::NikonCustom::SettingsD3',
3535 },
3536 },
3537 # note: DecryptLen currently set to 825
3538);
3539
3540# shot information for the D300S firmware 1.00 (encrypted) - ref PH
3541%Image::ExifTool::Nikon::ShotInfoD300S = (
3542 PROCESS_PROC => \&Image::ExifTool::Nikon::ProcessNikonEncrypted,
3543 WRITE_PROC => \&Image::ExifTool::Nikon::ProcessNikonEncrypted,
3544 CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
3545 VARS => { ID_LABEL => 'Index' },
3546 IS_SUBDIR => [ 804 ],
3547 WRITABLE => 1,
3548 FIRST_ENTRY => 0,
3549 GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
3550 NOTES => q{
3551 These tags are extracted from encrypted data in images from the D300S with
3552 firmware 1.00.
3553 },
3554 0x00 => {
3555 Name => 'ShotInfoVersion',
3556 Format => 'string[4]',
3557 Writable => 0,
3558 },
3559 0x04 => {
3560 Name => 'FirmwareVersion',
3561 Format => 'string[5]',
3562 Writable => 0,
3563 },
3564 613 => {
3565 Name => 'ISO2',
3566 ValueConv => '100*exp(($val/12-5)*log(2))',
3567 ValueConvInv => '(log($val/100)/log(2)+5)*12',
3568 PrintConv => 'int($val + 0.5)',
3569 PrintConvInv => '$val',
3570 },
3571 646 => {
3572 Name => 'ShutterCount',
3573 Format => 'int32u',
3574 Priority => 0,
3575 },
3576 804 => { #(NC)
3577 Name => 'CustomSettingsD300S',
3578 Format => 'undef[24]',
3579 SubDirectory => {
3580 TagTable => 'Image::ExifTool::NikonCustom::SettingsD3',
3581 },
3582 },
3583 # note: DecryptLen currently set to 827
3584);
3585
3586# shot information for the D700 firmware 1.02f (encrypted) - ref 29
3587%Image::ExifTool::Nikon::ShotInfoD700 = (
3588 PROCESS_PROC => \&Image::ExifTool::Nikon::ProcessNikonEncrypted,
3589 WRITE_PROC => \&Image::ExifTool::Nikon::ProcessNikonEncrypted,
3590 CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
3591 VARS => { ID_LABEL => 'Index' },
3592 IS_SUBDIR => [ 804 ],
3593 WRITABLE => 1,
3594 FIRST_ENTRY => 0,
3595 GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
3596 NOTES => q{
3597 These tags are extracted from encrypted data in images from the D700 with
3598 firmware 1.02f.
3599 },
3600 0x00 => {
3601 Name => 'ShotInfoVersion',
3602 Format => 'string[4]',
3603 Writable => 0,
3604 },
3605 0x04 => {
3606 Name => 'FirmwareVersion',
3607 Format => 'string[5]',
3608 Writable => 0,
3609 },
3610 613 => { # 0x265
3611 Name => 'ISO2',
3612 ValueConv => '100*exp(($val/12-5)*log(2))',
3613 ValueConvInv => '(log($val/100)/log(2)+5)*12',
3614 PrintConv => 'int($val + 0.5)',
3615 PrintConvInv => '$val',
3616 },
3617 0x287 => {
3618 Name => 'ShutterCount',
3619 Format => 'int32u',
3620 Priority => 0,
3621 },
3622 804 => { # 0x324 (NC)
3623 Name => 'CustomSettingsD700',
3624 Format => 'undef[48]',
3625 SubDirectory => {
3626 TagTable => 'Image::ExifTool::NikonCustom::SettingsD700',
3627 },
3628 },
3629 # note: DecryptLen currently set to 852
3630);
3631
3632# shot information for the D5000 firmware 1.00 (encrypted) - ref PH
3633%Image::ExifTool::Nikon::ShotInfoD5000 = (
3634 PROCESS_PROC => \&Image::ExifTool::Nikon::ProcessNikonEncrypted,
3635 WRITE_PROC => \&Image::ExifTool::Nikon::ProcessNikonEncrypted,
3636 CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
3637 VARS => { ID_LABEL => 'Index' },
3638 IS_SUBDIR => [ 0x378 ],
3639 WRITABLE => 1,
3640 FIRST_ENTRY => 0,
3641 GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
3642 NOTES => q{
3643 These tags are extracted from encrypted data in images from the D5000 with
3644 firmware 1.00.
3645 },
3646 0x00 => {
3647 Name => 'ShotInfoVersion',
3648 Format => 'string[4]',
3649 Writable => 0,
3650 },
3651 0x04 => {
3652 Name => 'FirmwareVersion',
3653 Format => 'string[5]',
3654 Writable => 0,
3655 },
3656 0x2b5 => { # (also found at 0x2c0)
3657 Name => 'ISO2',
3658 ValueConv => '100*exp(($val/12-5)*log(2))',
3659 ValueConvInv => '(log($val/100)/log(2)+5)*12',
3660 PrintConv => 'int($val + 0.5)',
3661 PrintConvInv => '$val',
3662 },
3663 0x2d6 => {
3664 Name => 'ShutterCount',
3665 Format => 'int32u',
3666 Priority => 0,
3667 },
3668 0x378 => {
3669 Name => 'CustomSettingsD5000',
3670 Format => 'undef[34]',
3671 SubDirectory => {
3672 TagTable => 'Image::ExifTool::NikonCustom::SettingsD5000',
3673 },
3674 },
3675 # note: DecryptLen currently set to 0x39a
3676);
3677
3678# shot information for the D7000 firmware 1.01d (encrypted) - ref 29
3679%Image::ExifTool::Nikon::ShotInfoD7000 = (
3680 PROCESS_PROC => \&Image::ExifTool::Nikon::ProcessNikonEncrypted,
3681 WRITE_PROC => \&Image::ExifTool::Nikon::ProcessNikonEncrypted,
3682 CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
3683 VARS => { ID_LABEL => 'Index' },
3684 IS_SUBDIR => [ 1028 ],
3685 WRITABLE => 1,
3686 FIRST_ENTRY => 0,
3687 GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
3688 NOTES => q{
3689 These tags are extracted from encrypted data in images from the D7000 with
3690 firmware 1.01b.
3691 },
3692 0x00 => {
3693 Name => 'ShotInfoVersion',
3694 Format => 'string[4]',
3695 Writable => 0,
3696 },
3697 0x04 => {
3698 Name => 'FirmwareVersion',
3699 Format => 'string[5]',
3700 Writable => 0,
3701 },
3702 #613 => {
3703 # Name => 'ISO2',
3704 # ValueConv => '100*exp(($val/12-5)*log(2))',
3705 # ValueConvInv => '(log($val/100)/log(2)+5)*12',
3706 # PrintConv => 'int($val + 0.5)',
3707 # PrintConvInv => '$val',
3708 #},
3709 0x320 => { # 800
3710 Name => 'ShutterCount',
3711 Format => 'int32u',
3712 Priority => 0,
3713 },
3714 0x404 => { # 1028 (NC)
3715 Name => 'CustomSettingsD7000',
3716 Format => 'undef[48]',
3717 SubDirectory => {
3718 TagTable => 'Image::ExifTool::NikonCustom::SettingsD7000',
3719 },
3720 },
3721);
3722
3723# Flash information (ref JD)
3724%Image::ExifTool::Nikon::FlashInfo0100 = (
3725 %binaryDataAttrs,
3726 DATAMEMBER => [ 9.2, 15, 16 ],
3727 GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
3728 NOTES => q{
3729 These tags are used by the D2H, D2Hs, D2X, D2Xs, D50, D70, D70s, D80 and
3730 D200.
3731 },
3732 # NOTE: Must set ByteOrder in SubDirectory if any multi-byte integer tags added
3733 0 => {
3734 Name => 'FlashInfoVersion',
3735 Format => 'string[4]',
3736 Writable => 0,
3737 },
3738 4 => { #PH
3739 Name => 'FlashSource',
3740 PrintConv => {
3741 0 => 'None',
3742 1 => 'External',
3743 2 => 'Internal',
3744 },
3745 },
3746 # 5 - values: 46,48,50,54,78
3747 6 => {
3748 Format => 'int8u[2]',
3749 Name => 'ExternalFlashFirmware',
3750 SeparateTable => 'FlashFirmware',
3751 PrintConv => \%flashFirmware,
3752 },
3753 8 => {
3754 Name => 'ExternalFlashFlags',
3755 PrintConv => { BITMASK => {
3756 0 => 'Fired', #28
3757 2 => 'Bounce Flash', #PH
3758 4 => 'Wide Flash Adapter',
3759 5 => 'Dome Diffuser', #28
3760 }},
3761 },
3762 9.1 => {
3763 Name => 'FlashCommanderMode',
3764 Mask => 0x80,
3765 PrintConv => {
3766 0x00 => 'Off',
3767 0x80 => 'On',
3768 },
3769 },
3770 9.2 => {
3771 Name => 'FlashControlMode',
3772 Mask => 0x7f,
3773 DataMember => 'FlashControlMode',
3774 RawConv => '$$self{FlashControlMode} = $val',
3775 PrintConv => \%flashControlMode,
3776 SeparateTable => 'FlashControlMode',
3777 },
3778 10 => [
3779 {
3780 Name => 'FlashOutput',
3781 Condition => '$$self{FlashControlMode} >= 0x06',
3782 ValueConv => '2 ** (-$val/6)',
3783 ValueConvInv => '$val>0 ? -6*log($val)/log(2) : 0',
3784 PrintConv => '$val>0.99 ? "Full" : sprintf("%.0f%%",$val*100)',
3785 PrintConvInv => '$val=~/(\d+)/ ? $1/100 : 1',
3786 },
3787 {
3788 Name => 'FlashCompensation',
3789 Format => 'int8s',
3790 Priority => 0,
3791 ValueConv => '-$val/6',
3792 ValueConvInv => '-6 * $val',
3793 PrintConv => 'Image::ExifTool::Exif::PrintFraction($val)',
3794 PrintConvInv => 'Image::ExifTool::Exif::ConvertFraction($val)',
3795 },
3796 ],
3797 11 => {
3798 Name => 'FlashFocalLength',
3799 RawConv => '$val ? $val : undef',
3800 PrintConv => '"$val mm"',
3801 PrintConvInv => '$val=~/(\d+)/; $1 || 0',
3802 },
3803 12 => {
3804 Name => 'RepeatingFlashRate',
3805 RawConv => '$val ? $val : undef',
3806 PrintConv => '"$val Hz"',
3807 PrintConvInv => '$val=~/(\d+)/; $1 || 0',
3808 },
3809 13 => {
3810 Name => 'RepeatingFlashCount',
3811 RawConv => '$val ? $val : undef',
3812 },
3813 14 => { #PH
3814 Name => 'FlashGNDistance',
3815 SeparateTable => 1,
3816 PrintConv => \%flashGNDistance,
3817 },
3818 15 => {
3819 Name => 'FlashGroupAControlMode',
3820 Mask => 0x0f,
3821 DataMember => 'FlashGroupAControlMode',
3822 RawConv => '$$self{FlashGroupAControlMode} = $val',
3823 PrintConv => \%flashControlMode,
3824 SeparateTable => 'FlashControlMode',
3825 },
3826 16 => {
3827 Name => 'FlashGroupBControlMode',
3828 Mask => 0x0f,
3829 DataMember => 'FlashGroupBControlMode',
3830 RawConv => '$$self{FlashGroupBControlMode} = $val',
3831 PrintConv => \%flashControlMode,
3832 SeparateTable => 'FlashControlMode',
3833 },
3834 17 => [
3835 {
3836 Name => 'FlashGroupAOutput',
3837 Condition => '$$self{FlashGroupAControlMode} >= 0x06',
3838 ValueConv => '2 ** (-$val/6)',
3839 ValueConvInv => '$val>0 ? -6*log($val)/log(2) : 0',
3840 PrintConv => '$val>0.99 ? "Full" : sprintf("%.0f%%",$val*100)',
3841 PrintConvInv => '$val=~/(\d+)/ ? $1/100 : 1',
3842 },
3843 {
3844 Name => 'FlashGroupACompensation',
3845 Format => 'int8s',
3846 ValueConv => '-$val/6',
3847 ValueConvInv => '-6 * $val',
3848 PrintConv => '$val ? sprintf("%+.1f",$val) : 0',
3849 PrintConvInv => '$val',
3850 },
3851 ],
3852 18 => [
3853 {
3854 Name => 'FlashGroupBOutput',
3855 Condition => '$$self{FlashGroupBControlMode} >= 0x06',
3856 ValueConv => '2 ** (-$val/6)',
3857 ValueConvInv => '$val>0 ? -6*log($val)/log(2) : 0',
3858 PrintConv => '$val>0.99 ? "Full" : sprintf("%.0f%%",$val*100)',
3859 PrintConvInv => '$val=~/(\d+)/ ? $1/100 : 1',
3860 },
3861 {
3862 Name => 'FlashGroupBCompensation',
3863 Format => 'int8s',
3864 ValueConv => '-$val/6',
3865 ValueConvInv => '-6 * $val',
3866 PrintConv => '$val ? sprintf("%+.1f",$val) : 0',
3867 PrintConvInv => '$val',
3868 },
3869 ],
3870);
3871
3872# Flash information for D40, D40x, D3 and D300 (ref JD)
3873%Image::ExifTool::Nikon::FlashInfo0102 = (
3874 %binaryDataAttrs,
3875 DATAMEMBER => [ 9.2, 16.1, 17.1, 17.2 ],
3876 GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
3877 NOTES => q{
3878 These tags are used by the D3 (firmware 1.x), D40, D40X, D60 and D300
3879 (firmware 1.00).
3880 },
3881 # NOTE: Must set ByteOrder in SubDirectory if any multi-byte integer tags added
3882 0 => {
3883 Name => 'FlashInfoVersion',
3884 Format => 'string[4]',
3885 Writable => 0,
3886 },
3887 4 => { #PH
3888 Name => 'FlashSource',
3889 PrintConv => {
3890 0 => 'None',
3891 1 => 'External',
3892 2 => 'Internal',
3893 },
3894 },
3895 # 5 - values: 46,48,50,54,78
3896 6 => {
3897 Format => 'int8u[2]',
3898 Name => 'ExternalFlashFirmware',
3899 SeparateTable => 'FlashFirmware',
3900 PrintConv => \%flashFirmware,
3901 },
3902 8 => {
3903 Name => 'ExternalFlashFlags',
3904 PrintConv => { BITMASK => {
3905 0 => 'Fired', #28
3906 2 => 'Bounce Flash', #PH
3907 4 => 'Wide Flash Adapter',
3908 5 => 'Dome Diffuser', #28
3909 }},
3910 },
3911 9.1 => {
3912 Name => 'FlashCommanderMode',
3913 Mask => 0x80,
3914 PrintConv => {
3915 0x00 => 'Off',
3916 0x80 => 'On',
3917 },
3918 },
3919 9.2 => {
3920 Name => 'FlashControlMode',
3921 Mask => 0x7f,
3922 DataMember => 'FlashControlMode',
3923 RawConv => '$$self{FlashControlMode} = $val',
3924 PrintConv => \%flashControlMode,
3925 SeparateTable => 'FlashControlMode',
3926 },
3927 10 => [
3928 {
3929 Name => 'FlashOutput',
3930 Condition => '$$self{FlashControlMode} >= 0x06',
3931 ValueConv => '2 ** (-$val/6)',
3932 ValueConvInv => '$val>0 ? -6*log($val)/log(2) : 0',
3933 PrintConv => '$val>0.99 ? "Full" : sprintf("%.0f%%",$val*100)',
3934 PrintConvInv => '$val=~/(\d+)/ ? $1/100 : 1',
3935 },
3936 {
3937 Name => 'FlashCompensation',
3938 # this is the compensation from the camera (0x0012) for "Built-in" FlashType, or
3939 # the compensation from the external unit (0x0017) for "Optional" FlashType - PH
3940 Format => 'int8s',
3941 Priority => 0,
3942 ValueConv => '-$val/6',
3943 ValueConvInv => '-6 * $val',
3944 PrintConv => 'Image::ExifTool::Exif::PrintFraction($val)',
3945 PrintConvInv => 'Image::ExifTool::Exif::ConvertFraction($val)',
3946 },
3947 ],
3948 12 => {
3949 Name => 'FlashFocalLength',
3950 RawConv => '$val ? $val : undef',
3951 PrintConv => '"$val mm"',
3952 PrintConvInv => '$val=~/(\d+)/; $1 || 0',
3953 },
3954 13 => {
3955 Name => 'RepeatingFlashRate',
3956 RawConv => '$val ? $val : undef',
3957 PrintConv => '"$val Hz"',
3958 PrintConvInv => '$val=~/(\d+)/; $1 || 0',
3959 },
3960 14 => {
3961 Name => 'RepeatingFlashCount',
3962 RawConv => '$val ? $val : undef',
3963 },
3964 15 => { #PH
3965 Name => 'FlashGNDistance',
3966 SeparateTable => 1,
3967 PrintConv => \%flashGNDistance,
3968 },
3969 16.1 => {
3970 Name => 'FlashGroupAControlMode',
3971 Mask => 0x0f,
3972 Notes => 'note: group A tags may apply to the built-in flash settings for some models',
3973 DataMember => 'FlashGroupAControlMode',
3974 RawConv => '$$self{FlashGroupAControlMode} = $val',
3975 PrintConv => \%flashControlMode,
3976 SeparateTable => 'FlashControlMode',
3977 },
3978 17.1 => {
3979 Name => 'FlashGroupBControlMode',
3980 Mask => 0xf0,
3981 Notes => 'note: group B tags may apply to group A settings for some models',
3982 DataMember => 'FlashGroupBControlMode',
3983 RawConv => '$$self{FlashGroupBControlMode} = $val',
3984 ValueConv => '$val >> 4',
3985 ValueConvInv => '$val << 4',
3986 PrintConv => \%flashControlMode,
3987 SeparateTable => 'FlashControlMode',
3988 },
3989 17.2 => { #PH
3990 Name => 'FlashGroupCControlMode',
3991 Mask => 0x0f,
3992 Notes => 'note: group C tags may apply to group B settings for some models',
3993 DataMember => 'FlashGroupCControlMode',
3994 RawConv => '$$self{FlashGroupCControlMode} = $val',
3995 PrintConv => \%flashControlMode,
3996 SeparateTable => 'FlashControlMode',
3997 },
3998 18 => [
3999 {
4000 Name => 'FlashGroupAOutput',
4001 Condition => '$$self{FlashGroupAControlMode} >= 0x06',
4002 ValueConv => '2 ** (-$val/6)',
4003 ValueConvInv => '$val>0 ? -6*log($val)/log(2) : 0',
4004 PrintConv => '$val>0.99 ? "Full" : sprintf("%.0f%%",$val*100)',
4005 PrintConvInv => '$val=~/(\d+)/ ? $1/100 : 1',
4006 },
4007 {
4008 Name => 'FlashGroupACompensation',
4009 Format => 'int8s',
4010 ValueConv => '-$val/6',
4011 ValueConvInv => '-6 * $val',
4012 PrintConv => '$val ? sprintf("%+.1f",$val) : 0',
4013 PrintConvInv => '$val',
4014 },
4015 ],
4016 19 => [
4017 {
4018 Name => 'FlashGroupBOutput',
4019 Condition => '$$self{FlashGroupBControlMode} >= 0x60',
4020 ValueConv => '2 ** (-$val/6)',
4021 ValueConvInv => '$val>0 ? -6*log($val)/log(2) : 0',
4022 PrintConv => '$val>0.99 ? "Full" : sprintf("%.0f%%",$val*100)',
4023 PrintConvInv => '$val=~/(\d+)/ ? $1/100 : 1',
4024 },
4025 {
4026 Name => 'FlashGroupBCompensation',
4027 Format => 'int8s',
4028 ValueConv => '-$val/6',
4029 ValueConvInv => '-6 * $val',
4030 PrintConv => '$val ? sprintf("%+.1f",$val) : 0',
4031 PrintConvInv => '$val',
4032 },
4033 ],
4034 20 => [ #PH
4035 {
4036 Name => 'FlashGroupCOutput',
4037 Condition => '$$self{FlashGroupCControlMode} >= 0x06',
4038 ValueConv => '2 ** (-$val/6)',
4039 ValueConvInv => '$val>0 ? -6*log($val)/log(2) : 0',
4040 PrintConv => '$val>0.99 ? "Full" : sprintf("%.0f%%",$val*100)',
4041 PrintConvInv => '$val=~/(\d+)/ ? $1/100 : 1',
4042 },
4043 {
4044 Name => 'FlashGroupCCompensation',
4045 Format => 'int8s',
4046 ValueConv => '-$val/6',
4047 ValueConvInv => '-6 * $val',
4048 PrintConv => '$val ? sprintf("%+.1f",$val) : 0',
4049 PrintConvInv => '$val',
4050 },
4051 ],
4052);
4053
4054# Flash information for D90 and D700 (ref PH)
4055%Image::ExifTool::Nikon::FlashInfo0103 = (
4056 %binaryDataAttrs,
4057 DATAMEMBER => [ 9.2, 17.1, 18.1, 18.2 ],
4058 GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
4059 NOTES => q{
4060 These tags are used by the D3 (firmware 2.x), D3X, D3S, D90, D300 (firmware
4061 1.10), D300S, D700, D3000 and D5000.
4062 },
4063 # NOTE: Must set ByteOrder in SubDirectory if any multi-byte integer tags added
4064 0 => {
4065 Name => 'FlashInfoVersion',
4066 Format => 'string[4]',
4067 Writable => 0,
4068 },
4069 4 => { #PH
4070 Name => 'FlashSource',
4071 PrintConv => {
4072 0 => 'None',
4073 1 => 'External',
4074 2 => 'Internal',
4075 },
4076 },
4077 # 5 - values: 46,48,50,54,78
4078 6 => {
4079 Format => 'int8u[2]',
4080 Name => 'ExternalFlashFirmware',
4081 SeparateTable => 'FlashFirmware',
4082 PrintConv => \%flashFirmware,
4083 },
4084 8 => {
4085 Name => 'ExternalFlashFlags',
4086 PrintConv => { BITMASK => {
4087 0 => 'Fired', #28
4088 2 => 'Bounce Flash', #PH
4089 4 => 'Wide Flash Adapter',
4090 5 => 'Dome Diffuser', #28
4091 }},
4092 },
4093 9.1 => {
4094 Name => 'FlashCommanderMode',
4095 Mask => 0x80,
4096 PrintConv => {
4097 0x00 => 'Off',
4098 0x80 => 'On',
4099 },
4100 },
4101 9.2 => {
4102 Name => 'FlashControlMode',
4103 Mask => 0x7f,
4104 DataMember => 'FlashControlMode',
4105 RawConv => '$$self{FlashControlMode} = $val',
4106 PrintConv => \%flashControlMode,
4107 SeparateTable => 'FlashControlMode',
4108 },
4109 10 => [
4110 {
4111 Name => 'FlashOutput',
4112 Condition => '$$self{FlashControlMode} >= 0x06',
4113 ValueConv => '2 ** (-$val/6)',
4114 ValueConvInv => '$val>0 ? -6*log($val)/log(2) : 0',
4115 PrintConv => '$val>0.99 ? "Full" : sprintf("%.0f%%",$val*100)',
4116 PrintConvInv => '$val=~/(\d+)/ ? $1/100 : 1',
4117 },
4118 {
4119 Name => 'FlashCompensation',
4120 # this is the compensation from the camera (0x0012) for "Built-in" FlashType, or
4121 # the compensation from the external unit (0x0017) for "Optional" FlashType - PH
4122 Format => 'int8s',
4123 Priority => 0,
4124 ValueConv => '-$val/6',
4125 ValueConvInv => '-6 * $val',
4126 PrintConv => 'Image::ExifTool::Exif::PrintFraction($val)',
4127 PrintConvInv => 'Image::ExifTool::Exif::ConvertFraction($val)',
4128 },
4129 ],
4130 12 => { #JD
4131 Name => 'FlashFocalLength',
4132 RawConv => '($val and $val != 255) ? $val : undef',
4133 PrintConv => '"$val mm"',
4134 PrintConvInv => '$val=~/(\d+)/; $1 || 0',
4135 },
4136 13 => { #JD
4137 Name => 'RepeatingFlashRate',
4138 RawConv => '($val and $val != 255) ? $val : undef',
4139 PrintConv => '"$val Hz"',
4140 PrintConvInv => '$val=~/(\d+)/; $1 || 0',
4141 },
4142 14 => { #JD
4143 Name => 'RepeatingFlashCount',
4144 RawConv => '($val and $val != 255) ? $val : undef',
4145 },
4146 15 => { #28
4147 Name => 'FlashGNDistance',
4148 SeparateTable => 1,
4149 PrintConv => \%flashGNDistance,
4150 },
4151 16 => { #28
4152 Name => 'FlashColorFilter',
4153 PrintConv => {
4154 0x00 => 'None',
4155 1 => 'FL-GL1',
4156 2 => 'FL-GL2',
4157 9 => 'TN-A1',
4158 10 => 'TN-A2',
4159 65 => 'Red',
4160 66 => 'Blue',
4161 67 => 'Yellow',
4162 68 => 'Amber',
4163 },
4164 },
4165 17.1 => {
4166 Name => 'FlashGroupAControlMode',
4167 Mask => 0x0f,
4168 Notes => 'note: group A tags may apply to the built-in flash settings for some models',
4169 DataMember => 'FlashGroupAControlMode',
4170 RawConv => '$$self{FlashGroupAControlMode} = $val',
4171 PrintConv => \%flashControlMode,
4172 SeparateTable => 'FlashControlMode',
4173 },
4174 18.1 => {
4175 Name => 'FlashGroupBControlMode',
4176 Mask => 0xf0,
4177 Notes => 'note: group B tags may apply to group A settings for some models',
4178 DataMember => 'FlashGroupBControlMode',
4179 RawConv => '$$self{FlashGroupBControlMode} = $val',
4180 ValueConv => '$val >> 4',
4181 ValueConvInv => '$val << 4',
4182 PrintConv => \%flashControlMode,
4183 SeparateTable => 'FlashControlMode',
4184 },
4185 18.2 => { #PH
4186 Name => 'FlashGroupCControlMode',
4187 Mask => 0x0f,
4188 Notes => 'note: group C tags may apply to group B settings for some models',
4189 DataMember => 'FlashGroupCControlMode',
4190 RawConv => '$$self{FlashGroupCControlMode} = $val',
4191 PrintConv => \%flashControlMode,
4192 SeparateTable => 'FlashControlMode',
4193 },
4194 19 => [
4195 {
4196 Name => 'FlashGroupAOutput',
4197 Condition => '$$self{FlashGroupAControlMode} >= 0x06',
4198 ValueConv => '2 ** (-$val/6)',
4199 ValueConvInv => '$val>0 ? -6*log($val)/log(2) : 0',
4200 PrintConv => '$val>0.99 ? "Full" : sprintf("%.0f%%",$val*100)',
4201 PrintConvInv => '$val=~/(\d+)/ ? $1/100 : 1',
4202 },
4203 {
4204 Name => 'FlashGroupACompensation',
4205 Format => 'int8s',
4206 ValueConv => '-$val/6',
4207 ValueConvInv => '-6 * $val',
4208 PrintConv => '$val ? sprintf("%+.1f",$val) : 0',
4209 PrintConvInv => '$val',
4210 },
4211 ],
4212 20 => [
4213 {
4214 Name => 'FlashGroupBOutput',
4215 Condition => '$$self{FlashGroupBControlMode} >= 0x60',
4216 ValueConv => '2 ** (-$val/6)',
4217 ValueConvInv => '$val>0 ? -6*log($val)/log(2) : 0',
4218 PrintConv => '$val>0.99 ? "Full" : sprintf("%.0f%%",$val*100)',
4219 PrintConvInv => '$val=~/(\d+)/ ? $1/100 : 1',
4220 },
4221 {
4222 Name => 'FlashGroupBCompensation',
4223 Format => 'int8s',
4224 ValueConv => '-$val/6',
4225 ValueConvInv => '-6 * $val',
4226 PrintConv => '$val ? sprintf("%+.1f",$val) : 0',
4227 PrintConvInv => '$val',
4228 },
4229 ],
4230 21 => [ #PH
4231 {
4232 Name => 'FlashGroupCOutput',
4233 Condition => '$$self{FlashGroupCControlMode} >= 0x06',
4234 ValueConv => '2 ** (-$val/6)',
4235 ValueConvInv => '$val>0 ? -6*log($val)/log(2) : 0',
4236 PrintConv => '$val>0.99 ? "Full" : sprintf("%.0f%%",$val*100)',
4237 PrintConvInv => '$val=~/(\d+)/ ? $1/100 : 1',
4238 },
4239 {
4240 Name => 'FlashGroupCCompensation',
4241 Format => 'int8s',
4242 ValueConv => '-$val/6',
4243 ValueConvInv => '-6 * $val',
4244 PrintConv => '$val ? sprintf("%+.1f",$val) : 0',
4245 PrintConvInv => '$val',
4246 },
4247 ],
4248);
4249
4250# Unknown Flash information
4251%Image::ExifTool::Nikon::FlashInfoUnknown = (
4252 %binaryDataAttrs,
4253 GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
4254 0 => {
4255 Name => 'FlashInfoVersion',
4256 Format => 'string[4]',
4257 Writable => 0,
4258 },
4259);
4260
4261# Multi exposure / image overlay information (ref PH)
4262%Image::ExifTool::Nikon::MultiExposure = (
4263 %binaryDataAttrs,
4264 FORMAT => 'int32u',
4265 GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
4266 # NOTE: Must set ByteOrder in SubDirectory if any multi-byte integer tags added
4267 0 => {
4268 Name => 'MultiExposureVersion',
4269 Format => 'string[4]',
4270 Writable => 0,
4271 },
4272 1 => {
4273 Name => 'MultiExposureMode',
4274 PrintConv => {
4275 0 => 'Off',
4276 1 => 'Multiple Exposure',
4277 2 => 'Image Overlay',
4278 },
4279 },
4280 2 => 'MultiExposureShots',
4281 3 => {
4282 Name => 'MultiExposureAutoGain',
4283 PrintConv => \%offOn,
4284 },
4285);
4286
4287# tags in Nikon QuickTime videos (PH - observations with Coolpix S3)
4288# (similar information in Kodak,Minolta,Nikon,Olympus,Pentax and Sanyo videos)
4289%Image::ExifTool::Nikon::MOV = (
4290 PROCESS_PROC => \&Image::ExifTool::ProcessBinaryData,
4291 GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
4292 FIRST_ENTRY => 0,
4293 NOTES => q{
4294 This information is found in MOV and QT videos from some Nikon cameras.
4295 },
4296 0x00 => {
4297 Name => 'Make',
4298 Format => 'string[24]',
4299 },
4300 0x18 => {
4301 Name => 'Model',
4302 Description => 'Camera Model Name',
4303 Format => 'string[8]',
4304 },
4305 # (01 00 at offset 0x20)
4306 0x26 => {
4307 Name => 'ExposureTime',
4308 Format => 'int32u',
4309 ValueConv => '$val ? 10 / $val : 0',
4310 PrintConv => 'Image::ExifTool::Exif::PrintExposureTime($val)',
4311 },
4312 0x2a => {
4313 Name => 'FNumber',
4314 Format => 'rational64u',
4315 PrintConv => 'sprintf("%.1f",$val)',
4316 },
4317 0x32 => {
4318 Name => 'ExposureCompensation',
4319 Format => 'rational64s',
4320 PrintConv => 'Image::ExifTool::Exif::PrintFraction($val)',
4321 },
4322 0x44 => {
4323 Name => 'WhiteBalance',
4324 Format => 'int16u',
4325 PrintConv => {
4326 0 => 'Auto',
4327 1 => 'Daylight',
4328 2 => 'Shade',
4329 3 => 'Fluorescent', #2
4330 4 => 'Tungsten',
4331 5 => 'Manual',
4332 },
4333 },
4334 0x48 => {
4335 Name => 'FocalLength',
4336 Format => 'rational64u',
4337 PrintConv => 'sprintf("%.1f mm",$val)',
4338 },
4339 0xaf => {
4340 Name => 'Software',
4341 Format => 'string[16]',
4342 },
4343 0xdf => { # (this is a guess ... could also be offset 0xdb)
4344 Name => 'ISO',
4345 Format => 'int16u',
4346 RawConv => '$val < 50 ? undef : $val', # (not valid for Coolpix L10)
4347 },
4348);
4349
4350# Nikon metadata in AVI videos (PH)
4351%Image::ExifTool::Nikon::AVI = (
4352 NOTES => 'Nikon-specific RIFF tags found in AVI videos.',
4353 GROUPS => { 0 => 'MakerNotes', 2 => 'Video' },
4354 nctg => {
4355 Name => 'NikonTags',
4356 SubDirectory => { TagTable => 'Image::ExifTool::Nikon::AVITags' },
4357 },
4358 ncth => {
4359 Name => 'ThumbnailImage',
4360 Binary => 1,
4361 },
4362 ncvr => {
4363 Name => 'NikonVers',
4364 SubDirectory => { TagTable => 'Image::ExifTool::Nikon::AVIVers' },
4365 },
4366 ncvw => {
4367 Name => 'PreviewImage',
4368 RawConv => 'length($val) ? $val : undef',
4369 Binary => 1,
4370 },
4371);
4372
4373# version information in AVI videos (PH)
4374%Image::ExifTool::Nikon::AVIVers = (
4375 GROUPS => { 0 => 'MakerNotes', 2 => 'Video' },
4376 PROCESS_PROC => \&ProcessNikonAVI,
4377 FORMAT => 'string',
4378 0x01 => 'MakerNoteType',
4379 0x02 => {
4380 Name => 'MakerNoteVersion',
4381 Format => 'int8u',
4382 ValueConv => 'my @a = reverse split " ", $val; join ".", @a;',
4383 },
4384);
4385
4386# tags in AVI videos (PH)
4387%Image::ExifTool::Nikon::AVITags = (
4388 GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
4389 PROCESS_PROC => \&ProcessNikonAVI,
4390 FORMAT => 'string',
4391 NOTES => q{
4392 These tags and the AVIVer tags below are found in proprietary-format records
4393 of Nikon AVI videos.
4394 },
4395 0x03 => 'Make',
4396 0x04 => 'Model',
4397 0x05 => {
4398 Name => 'Software',
4399 Format => 'undef',
4400 ValueConv => '$val =~ tr/\0//d; $val',
4401 },
4402 0x06 => 'Equipment', # "NIKON DIGITAL CAMERA"
4403 0x07 => { # (guess)
4404 Name => 'Orientation',
4405 Format => 'int16u',
4406 Groups => { 2 => 'Image' },
4407 PrintConv => \%Image::ExifTool::Exif::orientation,
4408 },
4409 0x08 => {
4410 Name => 'ExposureTime',
4411 Format => 'rational64u',
4412 Groups => { 2 => 'Image' },
4413 PrintConv => 'Image::ExifTool::Exif::PrintExposureTime($val)',
4414 },
4415 0x09 => {
4416 Name => 'FNumber',
4417 Format => 'rational64u',
4418 Groups => { 2 => 'Image' },
4419 PrintConv => 'sprintf("%.1f",$val)',
4420 },
4421 0x0a => {
4422 Name => 'ExposureCompensation',
4423 Format => 'rational64s',
4424 Groups => { 2 => 'Image' },
4425 PrintConv => 'Image::ExifTool::Exif::PrintFraction($val)',
4426 },
4427 0x0b => {
4428 Name => 'MaxApertureValue',
4429 Format => 'rational64u',
4430 ValueConv => '2 ** ($val / 2)',
4431 PrintConv => 'sprintf("%.1f",$val)',
4432 },
4433 0x0c => {
4434 Name => 'MeteringMode', # (guess)
4435 Format => 'int16u',
4436 PrintConv => {
4437 0 => 'Unknown',
4438 1 => 'Average',
4439 2 => 'Center-weighted average',
4440 3 => 'Spot',
4441 4 => 'Multi-spot',
4442 5 => 'Multi-segment',
4443 6 => 'Partial',
4444 255 => 'Other',
4445 },
4446 },
4447 0x0d => { # val: 0
4448 Name => 'Nikon_AVITags_0x000d',
4449 Format => 'int16u',
4450 Flags => [ 'Hidden', 'Unknown' ],
4451 },
4452 0x0e => { # val: 0
4453 Name => 'Nikon_AVITags_0x000e',
4454 Format => 'int16u',
4455 Flags => [ 'Hidden', 'Unknown' ],
4456 },
4457 0x0f => {
4458 Name => 'FocalLength',
4459 Format => 'rational64u',
4460 PrintConv => 'sprintf("%.1f mm",$val)',
4461 },
4462 0x10 => {
4463 Name => 'XResolution',
4464 Format => 'rational64u',
4465 Groups => { 2 => 'Image' },
4466 },
4467 0x11 => {
4468 Name => 'YResolution',
4469 Format => 'rational64u',
4470 Groups => { 2 => 'Image' },
4471 },
4472 0x12 => {
4473 Name => 'ResolutionUnit',
4474 Format => 'int16u',
4475 Groups => { 2 => 'Image' },
4476 PrintConv => {
4477 1 => 'None',
4478 2 => 'inches',
4479 3 => 'cm',
4480 },
4481 },
4482 0x13 => {
4483 Name => 'DateTimeOriginal', # (guess)
4484 Description => 'Date/Time Original',
4485 Groups => { 2 => 'Time' },
4486 PrintConv => '$self->ConvertDateTime($val)',
4487 },
4488 0x14 => {
4489 Name => 'CreateDate', # (guess)
4490 Groups => { 2 => 'Time' },
4491 PrintConv => '$self->ConvertDateTime($val)',
4492 },
4493 0x15 => {
4494 Name => 'Nikon_AVITags_0x0015',
4495 Format => 'int16u',
4496 Flags => [ 'Hidden', 'Unknown' ],
4497 },
4498 0x16 => {
4499 Name => 'Duration',
4500 Format => 'rational64u',
4501 PrintConv => '"$val s"',
4502 },
4503 0x17 => { # val: 1
4504 Name => 'Nikon_AVITags_0x0017',
4505 Format => 'int16u',
4506 Flags => [ 'Hidden', 'Unknown' ],
4507 },
4508 0x18 => 'FocusMode',
4509 0x19 => { # vals: -5, -2, 3, 5, 6, 8, 11, 12, 14, 20, 22
4510 Name => 'Nikon_AVITags_0x0019',
4511 Format => 'int32s',
4512 Flags => [ 'Hidden', 'Unknown' ],
4513 },
4514 0x1b => { # vals: 1 (640x480), 1.25 (320x240)
4515 Name => 'DigitalZoom',
4516 Format => 'rational64u',
4517 },
4518 0x1c => { # (same as Nikon_0x000a)
4519 Name => 'Nikon_AVITags_0x001c',
4520 Format => 'rational64u',
4521 Flags => [ 'Hidden', 'Unknown' ],
4522 },
4523 0x1d => 'ColorMode',
4524 0x1e => { # string[8] - val: "AUTO"
4525 Name => 'Sharpness', # (guess, could also be ISOSelection)
4526 },
4527 0x1f => { # string[16] - val: "AUTO"
4528 Name => 'WhiteBalance', # (guess, could also be ImageAdjustment)
4529 },
4530 0x20 => { # string[4] - val: "OFF"
4531 Name => 'NoiseReduction', # (guess)
4532 },
4533 0x801a => { # val: 0 (why is the 0x8000 bit set in the ID?)
4534 Name => 'Nikon_AVITags_0x801a',
4535 Format => 'int32s',
4536 Flags => [ 'Hidden', 'Unknown' ],
4537 }
4538);
4539
4540# Nikon NCDT atoms (ref PH)
4541%Image::ExifTool::Nikon::NCDT = (
4542 GROUPS => { 0 => 'MakerNotes', 1 => 'Nikon', 2 => 'Video' },
4543 NOTES => q{
4544 Nikon-specific QuickTime tags found in the NCDT atom of MOV videos from some
4545 Nikon cameras such as the Coolpix S8000.
4546 },
4547 NCHD => {
4548 Name => 'MakerNoteVersion',
4549 Format => 'undef',
4550 ValueConv => q{
4551 $val =~ s/\0$//; # remove trailing null
4552 $val =~ s/([\0-\x1f])/'.'.ord($1)/ge;
4553 $val =~ s/\./ /; return $val;
4554 },
4555 },
4556 NCTG => {
4557 Name => 'NikonTags',
4558 SubDirectory => { TagTable => 'Image::ExifTool::Nikon::NCTG' },
4559 },
4560 NCTH => { Name => 'ThumbnailImage', Format => 'undef', Binary => 1 },
4561 NCVW => { Name => 'PreviewImage', Format => 'undef', Binary => 1 },
4562 # NCDB - 0 bytes long, or 4 null bytes
4563);
4564
4565# Nikon NCTG tags from MOV videos (ref PH)
4566%Image::ExifTool::Nikon::NCTG = (
4567 PROCESS_PROC => \&ProcessNikonMOV,
4568 GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
4569 NOTES => q{
4570 These tags are found in proprietary-format records of the NCTG atom in MOV
4571 videos from some Nikon cameras.
4572 },
4573 0x01 => 'Make',
4574 0x02 => 'Model',
4575 0x03 => 'Software',
4576 0x11 => {
4577 Name => 'CreateDate', #(guess, but matches QuickTime CreateDate)
4578 Groups => { 2 => 'Time' },
4579 PrintConv => '$self->ConvertDateTime($val)',
4580 },
4581 0x12 => {
4582 Name => 'DateTimeOriginal', #(guess, but time is 1 sec before tag 0x11)
4583 Description => 'Date/Time Original',
4584 Groups => { 2 => 'Time' },
4585 PrintConv => '$self->ConvertDateTime($val)',
4586 },
4587 0x13 => {
4588 Name => 'FrameCount',
4589 # int32u[2]: "467 0", "1038 0", "1127 0"
4590 ValueConv => '$val =~ s/ 0$//; $val', # (not sure what the extra "0" is for)
4591 },
4592 # 0x14 - int32u[2]: "0 0"
4593 # 0x15 - int32u[2]: "0 0"
4594 0x16 => {
4595 Name => 'FrameRate',
4596 Groups => { 2 => 'Video' },
4597 PrintConv => 'int($val * 1000 + 0.5) / 1000',
4598 },
4599 # 0x21 - int16u: 1, 2
4600 0x22 => {
4601 Name => 'FrameWidth',
4602 Groups => { 2 => 'Video' },
4603 },
4604 0x23 => {
4605 Name => 'FrameHeight',
4606 Groups => { 2 => 'Video' },
4607 },
4608 # 0x24 - int16u: 2
4609 # 0x31 - int16u: 1, 2
4610 0x32 => { #(guess)
4611 Name => 'AudioChannels',
4612 Groups => { 2 => 'Audio' },
4613 },
4614 0x33 => {
4615 Name => 'AudioBitsPerSample',
4616 Groups => { 2 => 'Audio' },
4617 },
4618 0x34 => {
4619 Name => 'AudioSampleRate',
4620 Groups => { 2 => 'Audio' },
4621 },
4622 0x2000001 => {
4623 Name => 'MakerNoteVersion',
4624 PrintConv => '$_=$val;s/^(\d{2})/$1\./;s/^0//;$_',
4625 },
4626 0x2000005 => 'WhiteBalance',
4627 0x200000b => 'WhiteBalanceFineTune',
4628 0x200001e => {
4629 Name => 'ColorSpace',
4630 PrintConv => {
4631 1 => 'sRGB',
4632 2 => 'Adobe RGB',
4633 },
4634 },
4635 0x2000023 => {
4636 Name => 'PictureControlData',
4637 Binary => 1,
4638 SubDirectory => { TagTable => 'Image::ExifTool::Nikon::PictureControl' },
4639 },
4640 0x2000024 => {
4641 Name => 'WorldTime',
4642 SubDirectory => { TagTable => 'Image::ExifTool::Nikon::WorldTime' },
4643 },
4644 0x2000032 => {
4645 Name => 'UnknownInfo',
4646 SubDirectory => { TagTable => 'Image::ExifTool::Nikon::UnknownInfo' },
4647 },
4648 0x2000083 => {
4649 Name => 'LensType',
4650 # credit to Tom Christiansen (ref 7) for figuring this out...
4651 PrintConv => q[$_ = $val ? Image::ExifTool::DecodeBits($val,
4652 {
4653 0 => 'MF',
4654 1 => 'D',
4655 2 => 'G',
4656 3 => 'VR',
4657 }) : 'AF';
4658 # remove commas and change "D G" to just "G"
4659 s/,//g; s/\bD G\b/G/; $_
4660 ],
4661 },
4662 0x2000084 => {
4663 Name => "Lens",
4664 # short focal, long focal, aperture at short focal, aperture at long focal
4665 PrintConv => \&Image::ExifTool::Exif::PrintLensInfo,
4666 },
4667);
4668
4669# Nikon composite tags
4670%Image::ExifTool::Nikon::Composite = (
4671 GROUPS => { 2 => 'Camera' },
4672 LensSpec => {
4673 Description => 'Lens',
4674 Require => {
4675 0 => 'Nikon:Lens',
4676 1 => 'Nikon:LensType',
4677 },
4678 ValueConv => '"$val[0] $val[1]"',
4679 PrintConv => '"$prt[0] $prt[1]"',
4680 },
4681 LensID => {
4682 SeparateTable => 'Nikon LensID', # print values in a separate table
4683 Require => {
4684 0 => 'Nikon:LensIDNumber',
4685 1 => 'LensFStops',
4686 2 => 'MinFocalLength',
4687 3 => 'MaxFocalLength',
4688 4 => 'MaxApertureAtMinFocal',
4689 5 => 'MaxApertureAtMaxFocal',
4690 6 => 'MCUVersion',
4691 7 => 'Nikon:LensType',
4692 },
4693 # construct lens ID string as per ref 11
4694 ValueConv => 'uc(join(" ",(unpack("H*",pack("C*",@raw)) =~ /../g)))',
4695 PrintConv => \%nikonLensIDs,
4696 },
4697 AutoFocus => {
4698 Require => {
4699 0 => 'Nikon:PhaseDetectAF',
4700 1 => 'Nikon:ContrastDetectAF',
4701 },
4702 ValueConv => '($val[0] or $val[1]) ? 1 : 0',
4703 PrintConv => \%offOn,
4704 },
4705);
4706
4707# add our composite tags
4708Image::ExifTool::AddCompositeTags('Image::ExifTool::Nikon');
4709
4710#------------------------------------------------------------------------------
4711# Process Nikon AVI tags (D5000 videos)
4712# Inputs: 0) ExifTool object ref, 1) dirInfo ref, 2) tag table ref
4713# Returns: 1 on success
4714sub ProcessNikonAVI($$$)
4715{
4716 my ($exifTool, $dirInfo, $tagTablePtr) = @_;
4717 my $dataPt = $$dirInfo{DataPt};
4718 my $pos = $$dirInfo{DirStart} || 0;
4719 my $dirEnd = $pos + $$dirInfo{DirLen};
4720 $exifTool->VerboseDir($dirInfo, undef, $$dirInfo{DirLen});
4721 SetByteOrder('II');
4722 while ($pos + 4 <= $dirEnd) {
4723 my $tag = Get16u($dataPt, $pos);
4724 my $size = Get16u($dataPt, $pos + 2);
4725 $pos += 4;
4726 last if $pos + $size > $dirEnd;
4727 $exifTool->HandleTag($tagTablePtr, $tag, undef,
4728 DataPt => $dataPt,
4729 Start => $pos,
4730 Size => $size,
4731 );
4732 $pos += $size;
4733 }
4734 return 1;
4735}
4736#------------------------------------------------------------------------------
4737# Print D3/D300 AF points (similar to Canon::PrintAFPoints1D)
4738# Inputs: 0) value to convert (undef[7])
4739# Focus point pattern:
4740# A1 A2 A3 A4 A5 A6 A7 A8 A9
4741# B1 B2 B3 B4 B5 B6 B7 B8 B9 B10 B11
4742# C1 C2 C3 C4 C5 C6 C7 C8 C9 C10 C11
4743# D1 D2 D3 D4 D5 D6 D7 D8 D9 D10 D11
4744# E1 E2 E3 E4 E5 E6 E7 E8 E9
4745sub PrintAFPointsD3($)
4746{
4747 my $val = shift;
4748 return 'Unknown' unless length $val == 7;
4749 # list of byte/bit positions for each focus point (upper/lower nibble)
4750 my @focusPts = (
4751 0x55,0x50,0x43,0x14,0x02,0x07,0x21,0x26,0x33,
4752 0x61,0x54,0x47,0x42,0x13,0x01,0x06,0x20,0x25,0x32,0x37,
4753 0x60,0x53,0x46,0x41,0x12,0x00,0x05,0x17,0x24,0x31,0x36,
4754 0x62,0x56,0x51,0x44,0x15,0x03,0x10,0x22,0x27,0x34,0x40,
4755 0x57,0x52,0x45,0x16,0x04,0x11,0x23,0x30,0x35
4756 );
4757 my ($focusPt, @points);
4758 my @dat = unpack('C*', $val);
4759 my @cols = (9,11,11,11,9);
4760 my $cols = shift @cols;
4761 my ($row, $col) = ('A', 1);
4762 foreach $focusPt (@focusPts) {
4763 push @points, $row . $col if $dat[$focusPt >> 4] & (0x01 << ($focusPt & 0x0f));
4764 if (++$col > $cols) {
4765 $cols = shift @cols;
4766 $col = 1;
4767 ++$row;
4768 }
4769 }
4770 return '(none)' unless @points;
4771 return join(',',@points);
4772}
4773
4774#------------------------------------------------------------------------------
4775# Print PictureControl value
4776# Inputs: 0) value (with 0x80 subtracted),
4777# 1) 'Normal' (0 value) string (default 'Normal')
4778# 2) format string for numbers (default '%+d')
4779# Returns: PrintConv value
4780sub PrintPC($;$$)
4781{
4782 my ($val, $norm, $fmt) = @_;
4783 return $norm || 'Normal' if $val == 0;
4784 return 'n/a' if $val == 0x7f;
4785 return 'Auto' if $val == -128;
4786 # -127 = custom curve created in Camera Control Pro (show as "User" by D3) - ref 28
4787 return 'User' if $val == -127; #28
4788 return sprintf($fmt || '%+d', $val);
4789}
4790
4791#------------------------------------------------------------------------------
4792# Inverse of PrintPC
4793# Inputs: 0) PrintConv value (after subracting 0x80 from raw value)
4794# Returns: unconverted value
4795# Notes: raw values: 0=Auto, 1=User, 0xff=n/a, ... 0x7f=-1, 0x80=0, 0x81=1, ...
4796sub PrintPCInv($)
4797{
4798 my $val = shift;
4799 return $val if $val =~ /^[-+]?\d+$/;
4800 return 0x7f if $val =~ /n\/a/i;
4801 return -128 if $val =~ /auto/i;
4802 return -127 if $val =~ /user/i; #28
4803 return 0;
4804}
4805
4806#------------------------------------------------------------------------------
4807# Convert unknown LensID values
4808# Inputs: 0) value, 1) flag for inverse conversion, 2) PrintConv hash ref
4809sub LensIDConv($$$)
4810{
4811 my ($val, $inv, $conv) = @_;
4812 return undef if $inv;
4813 # multiple lenses with the same LensID are distinguished by decimal values
4814 if ($$conv{"$val.1"}) {
4815 my ($i, @vals, @user);
4816 for ($i=1; ; ++$i) {
4817 my $lens = $$conv{"$val.$i"} or last;
4818 if ($Image::ExifTool::userLens{$lens}) {
4819 push @user, $lens;
4820 } else {
4821 push @vals, $lens;
4822 }
4823 }
4824 return join(' or ', @user) if @user;
4825 return join(' or ', @vals);
4826 }
4827 my $regex = $val;
4828 # Sigma has been changing the LensID on some new lenses
4829 $regex =~ s/^\w+/../;
4830 my @ids = sort grep /^$regex$/, keys %$conv;
4831 return "Unknown ($val) $$conv{$ids[0]} ?" if @ids;
4832 return undef;
4833}
4834
4835#------------------------------------------------------------------------------
4836# Clean up formatting of string values
4837# Inputs: 0) string value
4838# Returns: formatted string value
4839# - removes trailing spaces and changes case to something more sensible
4840sub FormatString($)
4841{
4842 my $str = shift;
4843 # limit string length (can be very long for some unknown tags)
4844 if (length($str) > 60) {
4845 $str = substr($str,0,55) . "[...]";
4846 } else {
4847 $str =~ s/\s+$//; # remove trailing white space
4848 # Don't change case of non-words (no vowels)
4849 if ($str =~ /[AEIOUY]/) {
4850 # change all letters but the first to lower case,
4851 # but only in words containing a vowel
4852 if ($str =~ s/\b([AEIOUY])([A-Z]+)/$1\L$2/g) {
4853 $str =~ s/\bAf\b/AF/; # patch for "AF"
4854 # patch for a number of models that write improper string
4855 # terminator for ImageStabilization (VR-OFF, VR-ON)
4856 $str =~ s/ +.$//
4857 }
4858 if ($str =~ s/\b([A-Z])([A-Z]*[AEIOUY][A-Z]*)/$1\L$2/g) {
4859 $str =~ s/\bRaw\b/RAW/; # patch for "RAW"
4860 }
4861 }
4862 }
4863 return $str;
4864}
4865
4866#------------------------------------------------------------------------------
4867# decoding tables from ref 4
4868my @xlat = (
4869 [ 0xc1,0xbf,0x6d,0x0d,0x59,0xc5,0x13,0x9d,0x83,0x61,0x6b,0x4f,0xc7,0x7f,0x3d,0x3d,
4870 0x53,0x59,0xe3,0xc7,0xe9,0x2f,0x95,0xa7,0x95,0x1f,0xdf,0x7f,0x2b,0x29,0xc7,0x0d,
4871 0xdf,0x07,0xef,0x71,0x89,0x3d,0x13,0x3d,0x3b,0x13,0xfb,0x0d,0x89,0xc1,0x65,0x1f,
4872 0xb3,0x0d,0x6b,0x29,0xe3,0xfb,0xef,0xa3,0x6b,0x47,0x7f,0x95,0x35,0xa7,0x47,0x4f,
4873 0xc7,0xf1,0x59,0x95,0x35,0x11,0x29,0x61,0xf1,0x3d,0xb3,0x2b,0x0d,0x43,0x89,0xc1,
4874 0x9d,0x9d,0x89,0x65,0xf1,0xe9,0xdf,0xbf,0x3d,0x7f,0x53,0x97,0xe5,0xe9,0x95,0x17,
4875 0x1d,0x3d,0x8b,0xfb,0xc7,0xe3,0x67,0xa7,0x07,0xf1,0x71,0xa7,0x53,0xb5,0x29,0x89,
4876 0xe5,0x2b,0xa7,0x17,0x29,0xe9,0x4f,0xc5,0x65,0x6d,0x6b,0xef,0x0d,0x89,0x49,0x2f,
4877 0xb3,0x43,0x53,0x65,0x1d,0x49,0xa3,0x13,0x89,0x59,0xef,0x6b,0xef,0x65,0x1d,0x0b,
4878 0x59,0x13,0xe3,0x4f,0x9d,0xb3,0x29,0x43,0x2b,0x07,0x1d,0x95,0x59,0x59,0x47,0xfb,
4879 0xe5,0xe9,0x61,0x47,0x2f,0x35,0x7f,0x17,0x7f,0xef,0x7f,0x95,0x95,0x71,0xd3,0xa3,
4880 0x0b,0x71,0xa3,0xad,0x0b,0x3b,0xb5,0xfb,0xa3,0xbf,0x4f,0x83,0x1d,0xad,0xe9,0x2f,
4881 0x71,0x65,0xa3,0xe5,0x07,0x35,0x3d,0x0d,0xb5,0xe9,0xe5,0x47,0x3b,0x9d,0xef,0x35,
4882 0xa3,0xbf,0xb3,0xdf,0x53,0xd3,0x97,0x53,0x49,0x71,0x07,0x35,0x61,0x71,0x2f,0x43,
4883 0x2f,0x11,0xdf,0x17,0x97,0xfb,0x95,0x3b,0x7f,0x6b,0xd3,0x25,0xbf,0xad,0xc7,0xc5,
4884 0xc5,0xb5,0x8b,0xef,0x2f,0xd3,0x07,0x6b,0x25,0x49,0x95,0x25,0x49,0x6d,0x71,0xc7 ],
4885 [ 0xa7,0xbc,0xc9,0xad,0x91,0xdf,0x85,0xe5,0xd4,0x78,0xd5,0x17,0x46,0x7c,0x29,0x4c,
4886 0x4d,0x03,0xe9,0x25,0x68,0x11,0x86,0xb3,0xbd,0xf7,0x6f,0x61,0x22,0xa2,0x26,0x34,
4887 0x2a,0xbe,0x1e,0x46,0x14,0x68,0x9d,0x44,0x18,0xc2,0x40,0xf4,0x7e,0x5f,0x1b,0xad,
4888 0x0b,0x94,0xb6,0x67,0xb4,0x0b,0xe1,0xea,0x95,0x9c,0x66,0xdc,0xe7,0x5d,0x6c,0x05,
4889 0xda,0xd5,0xdf,0x7a,0xef,0xf6,0xdb,0x1f,0x82,0x4c,0xc0,0x68,0x47,0xa1,0xbd,0xee,
4890 0x39,0x50,0x56,0x4a,0xdd,0xdf,0xa5,0xf8,0xc6,0xda,0xca,0x90,0xca,0x01,0x42,0x9d,
4891 0x8b,0x0c,0x73,0x43,0x75,0x05,0x94,0xde,0x24,0xb3,0x80,0x34,0xe5,0x2c,0xdc,0x9b,
4892 0x3f,0xca,0x33,0x45,0xd0,0xdb,0x5f,0xf5,0x52,0xc3,0x21,0xda,0xe2,0x22,0x72,0x6b,
4893 0x3e,0xd0,0x5b,0xa8,0x87,0x8c,0x06,0x5d,0x0f,0xdd,0x09,0x19,0x93,0xd0,0xb9,0xfc,
4894 0x8b,0x0f,0x84,0x60,0x33,0x1c,0x9b,0x45,0xf1,0xf0,0xa3,0x94,0x3a,0x12,0x77,0x33,
4895 0x4d,0x44,0x78,0x28,0x3c,0x9e,0xfd,0x65,0x57,0x16,0x94,0x6b,0xfb,0x59,0xd0,0xc8,
4896 0x22,0x36,0xdb,0xd2,0x63,0x98,0x43,0xa1,0x04,0x87,0x86,0xf7,0xa6,0x26,0xbb,0xd6,
4897 0x59,0x4d,0xbf,0x6a,0x2e,0xaa,0x2b,0xef,0xe6,0x78,0xb6,0x4e,0xe0,0x2f,0xdc,0x7c,
4898 0xbe,0x57,0x19,0x32,0x7e,0x2a,0xd0,0xb8,0xba,0x29,0x00,0x3c,0x52,0x7d,0xa8,0x49,
4899 0x3b,0x2d,0xeb,0x25,0x49,0xfa,0xa3,0xaa,0x39,0xa7,0xc5,0xa7,0x50,0x11,0x36,0xfb,
4900 0xc6,0x67,0x4a,0xf5,0xa5,0x12,0x65,0x7e,0xb0,0xdf,0xaf,0x4e,0xb3,0x61,0x7f,0x2f ]
4901);
4902
4903# decrypt Nikon data block (ref 4)
4904# Inputs: 0) reference to data block, 1) serial number key, 2) shutter count key
4905# 4) optional start offset (default 0)
4906# 5) optional number of bytes to decode (default to the end of the data)
4907# Returns: data block with specified data decrypted
4908sub Decrypt($$$;$$)
4909{
4910 my ($dataPt, $serial, $count, $start, $len) = @_;
4911 my ($i, $dat);
4912
4913 $start or $start = 0;
4914 $len = length($$dataPt) - $start if not defined $len or $len > length($$dataPt) - $start;
4915 return $$dataPt if $len <= 0;
4916 my $key = 0;
4917 for ($i=0; $i<4; ++$i) {
4918 $key ^= ($count >> ($i*8)) & 0xff;
4919 }
4920 my $ci = $xlat[0][$serial & 0xff];
4921 my $cj = $xlat[1][$key];
4922 my $ck = 0x60;
4923 my @data = unpack("x${start}C$len", $$dataPt);
4924 foreach $dat (@data) {
4925 $cj = ($cj + $ci * $ck) & 0xff;
4926 $ck = ($ck + 1) & 0xff;
4927 $dat ^= $cj;
4928 }
4929 my $end = $start + $len;
4930 my $pre = $start ? substr($$dataPt, 0, $start) : '';
4931 my $post = $end < length($$dataPt) ? substr($$dataPt, $end) : '';
4932 return $pre . pack('C*',@data) . $post;
4933}
4934
4935#------------------------------------------------------------------------------
4936# Get serial number for use as a decryption key
4937# Inputs: 0) ExifTool object ref, 1) serial number string
4938# Returns: serial key integer or undef if no serial number provided
4939sub SerialKey($$)
4940{
4941 my ($exifTool, $serial) = @_;
4942 # use serial number as key if integral
4943 return $serial if not defined $serial or $serial =~ /^\d+$/;
4944 return 0x22 if $$exifTool{Model} =~ /\bD50$/; # D50 (ref 8)
4945 return 0x60; # D200 (ref 10), D40X (ref PH), etc
4946}
4947
4948#------------------------------------------------------------------------------
4949# Read Nikon NCTG tags in MOV videos
4950# Inputs: 0) ExifTool object ref, 1) dirInfo ref, 2) tag table ref
4951# Returns: 1 on success
4952sub ProcessNikonMOV($$$)
4953{
4954 my ($exifTool, $dirInfo, $tagTablePtr) = @_;
4955 my $dataPt = $$dirInfo{DataPt};
4956 my $dataPos = $$dirInfo{DataPos};
4957 my $pos = $$dirInfo{DirStart};
4958 my $end = $pos + $$dirInfo{DirLen};
4959 $exifTool->VerboseDir($$dirInfo{DirName}, 0, $$dirInfo{DirLen});
4960 while ($pos + 8 < $end) {
4961 my $tag = Get32u($dataPt, $pos);
4962 my $fmt = Get16u($dataPt, $pos + 4); # (same format code as EXIF)
4963 my $count = Get16u($dataPt, $pos + 6);
4964 $pos += 8;
4965 my $fmtStr = $Image::ExifTool::Exif::formatName[$fmt];
4966 unless ($fmtStr) {
4967 $exifTool->Warn(sprintf("Unknown format ($fmt) for $$dirInfo{DirName} tag 0x%x",$tag));
4968 last;
4969 }
4970 my $size = $count * $Image::ExifTool::Exif::formatSize[$fmt];
4971 if ($pos + $size > $end) {
4972 $exifTool->Warn(sprintf("Truncated data for $$dirInfo{DirName} tag 0x%x",$tag));
4973 last;
4974 }
4975 my $val = ReadValue($dataPt, $pos, $fmtStr, $count, $size);
4976 $exifTool->HandleTag($tagTablePtr, $tag, $val,
4977 DataPt => $dataPt,
4978 DataPos => $dataPos,
4979 Format => $fmtStr,
4980 Start => $pos,
4981 Size => $size,
4982 );
4983 $pos += $size; # is this padded to an even offset????
4984 }
4985 return 1;
4986}
4987
4988#------------------------------------------------------------------------------
4989# Read/Write Nikon Encrypted data block
4990# Inputs: 0) ExifTool object ref, 1) dirInfo ref, 2) tag table ref
4991# Returns: 1 on success when reading, or new directory when writing (IsWriting set)
4992sub ProcessNikonEncrypted($$$)
4993{
4994 my ($exifTool, $dirInfo, $tagTablePtr) = @_;
4995 $exifTool or return 1; # allow dummy access
4996 my $serial = $$exifTool{NikonSerialKey};
4997 my $count = $$exifTool{NikonCountKey};
4998 unless (defined $serial and defined $count) {
4999 if (defined $serial or defined $count) {
5000 my $missing = defined $serial ? 'ShutterCount' : 'SerialNumber';
5001 $exifTool->Warn("Can't decrypt Nikon information (no $missing key)");
5002 }
5003 delete $$exifTool{NikonSerialKey};
5004 delete $$exifTool{NikonCountKey};
5005 return 0;
5006 }
5007 my $verbose = $$dirInfo{IsWriting} ? 0 : $exifTool->Options('Verbose');
5008 my $tagInfo = $$dirInfo{TagInfo};
5009 my $data = substr(${$$dirInfo{DataPt}}, $$dirInfo{DirStart}, $$dirInfo{DirLen});
5010
5011 my ($start, $len, $offset, $byteOrder, $recrypt, $newSerial, $newCount);
5012
5013 # must re-encrypt when writing if serial number or shutter count changes
5014 if ($$dirInfo{IsWriting}) {
5015 if ($$exifTool{NewNikonSerialKey}) {
5016 $newSerial = $$exifTool{NewNikonSerialKey};
5017 $recrypt = 1;
5018 }
5019 if ($$exifTool{NewNikonCountKey}) {
5020 $newCount = $$exifTool{NewNikonCountKey};
5021 $recrypt = 1;
5022 }
5023 }
5024 if ($tagInfo and $$tagInfo{SubDirectory}) {
5025 $start = $tagInfo->{SubDirectory}->{DecryptStart};
5026 # may decrypt only part of the information to save time
5027 if ($verbose < 3 and $exifTool->Options('Unknown') < 2 and not $recrypt) {
5028 $len = $tagInfo->{SubDirectory}->{DecryptLen};
5029 }
5030 $offset = $tagInfo->{SubDirectory}->{DirOffset};
5031 $byteOrder = $tagInfo->{SubDirectory}->{ByteOrder};
5032 }
5033 $start or $start = 0;
5034 if (defined $offset) {
5035 # offset, if specified, is releative to start of encrypted data
5036 $offset += $start;
5037 } else {
5038 $offset = 0;
5039 }
5040 my $maxLen = length($data) - $start;
5041 # decrypt all the data unless DecryptLen is given
5042 $len = $maxLen unless $len and $len <= $maxLen;
5043
5044 $data = Decrypt(\$data, $serial, $count, $start, $len);
5045
5046 if ($verbose > 2) {
5047 $exifTool->VerboseDir("Decrypted $$tagInfo{Name}");
5048 $exifTool->VerboseDump(\$data,
5049 Prefix => $exifTool->{INDENT} . ' ',
5050 DataPos => $$dirInfo{DirStart} + $$dirInfo{DataPos} + ($$dirInfo{Base} || 0),
5051 );
5052 }
5053 # process the decrypted information
5054 my %subdirInfo = (
5055 DataPt => \$data,
5056 DirStart => $offset,
5057 DirLen => length($data) - $offset,
5058 DirName => $$dirInfo{DirName},
5059 DataPos => $$dirInfo{DataPos} + $$dirInfo{DirStart},
5060 Base => $$dirInfo{Base},
5061 );
5062 my $rtnVal;
5063 my $oldOrder = GetByteOrder();
5064 SetByteOrder($byteOrder) if $byteOrder;
5065 if ($$dirInfo{IsWriting}) {
5066 my $changed = $$exifTool{CHANGED};
5067 $rtnVal = $exifTool->WriteBinaryData(\%subdirInfo, $tagTablePtr);
5068 # must re-encrypt if serial number or shutter count changes
5069 if ($recrypt) {
5070 $serial = $newSerial if defined $newSerial;
5071 $count = $newCount if defined $newCount;
5072 ++$$exifTool{CHANGED};
5073 }
5074 if ($changed == $$exifTool{CHANGED}) {
5075 undef $rtnVal; # nothing changed so use original data
5076 } else {
5077 # add back any un-encrypted data at start
5078 $rtnVal = substr($data, 0, $offset) . $rtnVal if $offset;
5079 # re-encrypt data (symmetrical algorithm)
5080 $rtnVal = Decrypt(\$rtnVal, $serial, $count, $start, $len);
5081 }
5082 } else {
5083 $rtnVal = $exifTool->ProcessBinaryData(\%subdirInfo, $tagTablePtr);
5084 }
5085 SetByteOrder($oldOrder);
5086 return $rtnVal;
5087}
5088
5089#------------------------------------------------------------------------------
5090# Pre-scan EXIF directory to extract specific tags
5091# Inputs: 0) ExifTool object ref, 1) dirInfo ref, 2) required tagID hash ref
5092# Returns: 1 if directory was scanned successfully
5093sub PrescanExif($$$)
5094{
5095 my ($exifTool, $dirInfo, $tagHash) = @_;
5096 my $dataPt = $$dirInfo{DataPt};
5097 my $dataPos = $$dirInfo{DataPos} || 0;
5098 my $dataLen = $$dirInfo{DataLen};
5099 my $dirStart = $$dirInfo{DirStart} || 0;
5100 my $base = $$dirInfo{Base} || 0;
5101 my $raf = $$dirInfo{RAF};
5102 my ($index, $numEntries, $data, $buff);
5103
5104 # get number of entries in IFD
5105 if ($dirStart >= 0 and $dirStart <= $dataLen-2) {
5106 $numEntries = Get16u($dataPt, $dirStart);
5107 # reset $numEntries to read from file if necessary
5108 undef $numEntries if $dirStart + 2 + 12 * $numEntries > $dataLen;
5109 }
5110 # read IFD from file if necessary
5111 unless ($numEntries) {
5112 $raf or return 0;
5113 $dataPos += $dirStart; # read data from the start of the directory
5114 $raf->Seek($dataPos + $base, 0) and $raf->Read($data, 2) == 2 or return 0;
5115 $numEntries = Get16u(\$data, 0);
5116 my $len = 12 * $numEntries;
5117 $raf->Read($buff, $len) == $len or return 0;
5118 $data .= $buff;
5119 # update variables for the newly loaded IFD (already updated dataPos)
5120 $dataPt = \$data;
5121 $dataLen = length $data;
5122 $dirStart = 0;
5123 }
5124 # loop through necessary IFD entries
5125 my ($lastTag) = sort { $b <=> $a } keys %$tagHash; # (reverse sort)
5126 for ($index=0; $index<$numEntries; ++$index) {
5127 my $entry = $dirStart + 2 + 12 * $index;
5128 my $tagID = Get16u($dataPt, $entry);
5129 last if $tagID > $lastTag; # (assuming tags are in order)
5130 next unless exists $$tagHash{$tagID}; # only extract required tags
5131 my $format = Get16u($dataPt, $entry+2);
5132 next if $format < 1 or $format > 13;
5133 my $count = Get32u($dataPt, $entry+4);
5134 my $size = $count * $Image::ExifTool::Exif::formatSize[$format];
5135 my $formatStr = $Image::ExifTool::Exif::formatName[$format];
5136 my $valuePtr = $entry + 8; # pointer to value within $$dataPt
5137 if ($size > 4) {
5138 next if $size > 0x1000000; # set a reasonable limit on data size (16MB)
5139 $valuePtr = Get32u($dataPt, $valuePtr);
5140 # convert offset to pointer in $$dataPt
5141 # (don't yet handle EntryBased or FixOffsets)
5142 $valuePtr -= $dataPos;
5143 if ($valuePtr < 0 or $valuePtr+$size > $dataLen) {
5144 next unless $raf and $raf->Seek($base + $valuePtr + $dataPos,0) and
5145 $raf->Read($buff,$size) == $size;
5146 $$tagHash{$tagID} = ReadValue(\$buff,0,$formatStr,$count,$size);
5147 next;
5148 }
5149 }
5150 $$tagHash{$tagID} = ReadValue($dataPt,$valuePtr,$formatStr,$count,$size);
5151 }
5152 return 1;
5153}
5154
5155#------------------------------------------------------------------------------
5156# Process Nikon Capture history data
5157# Inputs: 0) ExifTool object ref, 1) dirInfo ref, 2) tag table ref
5158# Returns: 1 on success
5159sub ProcessNikonCaptureEditVersions($$$)
5160{
5161 my ($exifTool, $dirInfo, $tagTablePtr) = @_;
5162 require Image::ExifTool::NikonCapture;
5163 return Image::ExifTool::NikonCapture::ProcessNikonCaptureEditVersions($exifTool, $dirInfo, $tagTablePtr);
5164}
5165
5166#------------------------------------------------------------------------------
5167# process Nikon Capture Offsets IFD (ref PH)
5168# Inputs: 0) ExifTool object ref, 1) dirInfo ref, 2) tag table ref
5169# Returns: 1 on success
5170# Notes: This isn't a normal IFD, but is close...
5171sub ProcessNikonCaptureOffsets($$$)
5172{
5173 my ($exifTool, $dirInfo, $tagTablePtr) = @_;
5174 my $dataPt = $$dirInfo{DataPt};
5175 my $dirStart = $$dirInfo{DirStart};
5176 my $dirLen = $$dirInfo{DirLen};
5177 my $success = 0;
5178 return 0 unless $dirLen > 2;
5179 my $count = Get16u($dataPt, $dirStart);
5180 return 0 unless $count and $count * 12 + 2 <= $dirLen;
5181 if ($exifTool->Options('Verbose')) {
5182 $exifTool->VerboseDir('NikonCaptureOffsets', $count);
5183 }
5184 my $index;
5185 for ($index=0; $index<$count; ++$index) {
5186 my $pos = $dirStart + 12 * $index + 2;
5187 my $tagID = Get32u($dataPt, $pos);
5188 my $value = Get32u($dataPt, $pos + 4);
5189 $exifTool->HandleTag($tagTablePtr, $tagID, $value,
5190 Index => $index,
5191 DataPt => $dataPt,
5192 Start => $pos,
5193 Size => 12,
5194 ) and $success = 1;
5195 }
5196 return $success;
5197}
5198
5199#------------------------------------------------------------------------------
5200# Read/write Nikon Makernotes directory
5201# Inputs: 0) ExifTool object ref, 1) dirInfo ref, 2) tag table ref
5202# Returns: 1 on success, otherwise returns 0 and sets a Warning when reading
5203# or new directory when writing (IsWriting set in dirInfo)
5204sub ProcessNikon($$$)
5205{
5206 my ($exifTool, $dirInfo, $tagTablePtr) = @_;
5207 $exifTool or return 1; # allow dummy access
5208
5209 # pre-scan IFD to get SerialNumber (0x001d) and ShutterCount (0x00a7) for use in decryption
5210 my %needTags = ( 0x001d => 0, 0x00a7 => undef );
5211 PrescanExif($exifTool, $dirInfo, \%needTags);
5212 $$exifTool{NikonSerialKey} = SerialKey($exifTool, $needTags{0x001d});
5213 $$exifTool{NikonCountKey} = $needTags{0x00a7};
5214
5215 # process Nikon makernotes
5216 my $rtnVal;
5217 if ($$dirInfo{IsWriting}) {
5218 # get new decryptino keys if they are being changed
5219 my $serial = $exifTool->GetNewValues($Image::ExifTool::Nikon::Main{0x001d});
5220 my $count = $exifTool->GetNewValues($Image::ExifTool::Nikon::Main{0x00a7});
5221 $$exifTool{NewNikonSerialKey} = SerialKey($exifTool, $serial);
5222 $$exifTool{NewNikonCountKey} = $count;
5223 $rtnVal = Image::ExifTool::Exif::WriteExif($exifTool, $dirInfo, $tagTablePtr);
5224 delete $$exifTool{NewNikonSerialKey};
5225 delete $$exifTool{NewNikonCountKey};
5226 } else {
5227 $rtnVal = Image::ExifTool::Exif::ProcessExif($exifTool, $dirInfo, $tagTablePtr);
5228 }
5229 delete $$exifTool{NikonSerialKey};
5230 delete $$exifTool{NikonCountKey};
5231 return $rtnVal;
5232}
5233
52341; # end
5235
5236__END__
5237
5238=head1 NAME
5239
5240Image::ExifTool::Nikon - Nikon EXIF maker notes tags
5241
5242=head1 SYNOPSIS
5243
5244This module is loaded automatically by Image::ExifTool when required.
5245
5246=head1 DESCRIPTION
5247
5248This module contains definitions required by Image::ExifTool to interpret
5249Nikon maker notes in EXIF information.
5250
5251=head1 AUTHOR
5252
5253Copyright 2003-2011, Phil Harvey (phil at owl.phy.queensu.ca)
5254
5255This library is free software; you can redistribute it and/or modify it
5256under the same terms as Perl itself.
5257
5258=head1 REFERENCES
5259
5260=over 4
5261
5262=item L<http://park2.wakwak.com/~tsuruzoh/Computer/Digicams/exif-e.html>
5263
5264=item L<http://www.cybercom.net/~dcoffin/dcraw/>
5265
5266=item L<http://members.aol.com/khancock/pilot/nbuddy/>
5267
5268=item L<http://www.rottmerhusen.com/objektives/lensid/thirdparty.html>
5269
5270=item L<http://homepage3.nifty.com/kamisaka/makernote/makernote_nikon.htm>
5271
5272=item L<http://www.wohlberg.net/public/software/photo/nstiffexif/>
5273
5274=back
5275
5276=head1 ACKNOWLEDGEMENTS
5277
5278Thanks to Joseph Heled, Thomas Walter, Brian Ristuccia, Danek Duvall, Tom
5279Christiansen, Robert Rottmerhusen, Werner Kober, Roger Larsson, Jens Duttke,
5280Gregor Dorlars, Neil Nappe, Alexandre Naaman, Brendt Wohlberg and Warren
5281Hatch for their help figuring out some Nikon tags, and to everyone who
5282helped contribute to the LensID list.
5283
5284=head1 SEE ALSO
5285
5286L<Image::ExifTool::TagNames/Nikon Tags>,
5287L<Image::ExifTool::TagNames/NikonCapture Tags>,
5288L<Image::ExifTool(3pm)|Image::ExifTool>
5289
5290=cut
Note: See TracBrowser for help on using the repository browser.