~ubuntu-branches/ubuntu/karmic/libimage-exiftool-perl/karmic

« back to all changes in this revision

Viewing changes to lib/Image/ExifTool/Nikon.pm

  • Committer: Bazaar Package Importer
  • Author(s): Mari Wang
  • Date: 2008-02-04 20:32:53 UTC
  • mfrom: (1.1.5 upstream)
  • Revision ID: james.westby@ubuntu.com-20080204203253-mpbal8trlfe1fz5d
Tags: 7.00-1
* Upload of new production release (Closes: #456430)
* Added Recommends: libcompress-zlib-perl (Closes: #435589)
* Package now includes iptc2xmp.args and xmp2iptc.args, they are put
  into /usr/share/libimage-exiftool/ (Closes: #436100)
* Updated standards-version (3.7.2 -> 3.7.3). No changes needed.
* Lots of updates and bugfixes compared to last debian version
  (6.90).  See the Changes file for details
* Upload sponsored by Petter Reinholdtsen

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
#               4) http://www.cybercom.net/~dcoffin/dcraw/
19
19
#               5) Brian Ristuccia private communication (tests with D70)
20
20
#               6) Danek Duvall private communication (tests with D70)
21
 
#               7) Tom Christiansen private communication (tchrist@perl.com)
 
21
#               7) Tom Christiansen private communication (tests with D70)
22
22
#               8) Robert Rottmerhusen private communication
23
23
#               9) http://members.aol.com/khancock/pilot/nbuddy/
24
24
#              10) Werner Kober private communication (D2H, D2X, D100, D70, D200)
25
 
#              11) http://www.rottmerhusen.com/objektives/lensid/nikkor.html
 
25
#              11) http://www.rottmerhusen.com/objektives/lensid/thirdparty.html
26
26
#              12) http://libexif.sourceforge.net/internals/mnote-olympus-tag_8h-source.html
27
27
#              13) Roger Larsson private communication (tests with D200)
28
28
#              14) http://homepage3.nifty.com/kamisaka/makernote/makernote_nikon.htm
30
30
#              16) Jeffrey Friedl private communication (D200 with firmware update)
31
31
#              17) http://www.wohlberg.net/public/software/photo/nstiffexif/
32
32
#              18) Anonymous user private communication (D70, D200, D2x)
 
33
#              19) Jens Duttke private communication
 
34
#              20) Bruce Stevens private communication
 
35
#              21) Vladimir Sauta private communication (D80)
33
36
#------------------------------------------------------------------------------
34
37
 
35
38
package Image::ExifTool::Nikon;
39
42
use Image::ExifTool qw(:DataAccess :Utils);
40
43
use Image::ExifTool::Exif;
41
44
 
42
 
$VERSION = '1.69';
 
45
$VERSION = '1.76';
43
46
 
44
47
# nikon lens ID numbers (ref 8/11)
45
48
my %nikonLensIDs = (
47
50
        The Nikon LensID is constructed as a Composite tag from the raw hex values
48
51
        of 8 other tags: LensIDNumber, LensFStops, MinFocalLength, MaxFocalLength,
49
52
        MaxApertureAtMinFocal, MaxApertureAtMaxFocal, MCUVersion and LensType, in
50
 
        that order.
 
53
        that order.  (source:
 
54
        L<http://www.rottmerhusen.com/objektives/lensid/thirdparty.html>)
51
55
    },
52
56
    # (hex digits must be uppercase in keys below)
53
57
    '01 58 50 50 14 14 02 00' => 'AF Nikkor 50mm f/1.8',
82
86
    '1E 54 56 56 24 24 13 00' => 'AF Micro-Nikkor 60mm f/2.8',
83
87
    '1F 54 6A 6A 24 24 14 00' => 'AF Micro-Nikkor 105mm f/2.8',
84
88
    '20 48 60 80 24 24 15 00' => 'AF Zoom-Nikkor ED 80-200mm f/2.8',
 
89
    '21 40 3C 5C 2C 34 16 00' => 'AF Zoom-Nikkor 28-70mm f/3.5-4.5',
85
90
    '22 48 72 72 18 18 16 00' => 'AF DC-Nikkor 135mm f/2',
86
91
    '24 48 60 80 24 24 1A 02' => 'AF Zoom-Nikkor ED 80-200mm f/2.8D',
87
92
    '25 48 44 5C 24 24 1B 02' => 'AF Zoom-Nikkor 35-70mm f/2.8D',
123
128
    '5D 48 3C 5C 24 24 63 02' => 'AF-S Zoom-Nikkor 28-70mm f/2.8D IF-ED',
124
129
    '5E 48 60 80 24 24 64 02' => 'AF-S Zoom-Nikkor 80-200mm f/2.8D IF-ED',
125
130
    '5F 40 3C 6A 2C 34 65 02' => 'AF Zoom-Nikkor 28-105mm f/3.5-4.5D IF',
 
131
    '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)
126
132
    '61 44 5E 86 34 3C 67 02' => 'AF Zoom-Nikkor 75-240mm f/4.5-5.6D',
127
133
    '63 48 2B 44 24 24 68 02' => 'AF-S Nikkor 17-35mm f/2.8D IF-ED',
128
134
    '64 00 62 62 24 24 6A 02' => 'PC Micro-Nikkor 85mm f/2.8D',
153
159
    '82 48 8E 8E 24 24 87 0E' => 'AF-S VR Nikkor 300mm f/2.8G IF-ED',
154
160
    '89 3C 53 80 30 3C 8B 06' => 'AF-S DX Zoom-Nikkor 55-200mm f/4-5.6G ED',
155
161
    '8A 54 6A 6A 24 24 8C 0E' => 'AF-S VR Micro-Nikkor 105mm f/2.8G IF-ED', #10
 
162
    '8B 40 2D 80 2C 3C FD 0E' => 'AF-S DX VR Zoom-Nikkor 18-200mm f/3.5-5.6G IF-ED', #21
156
163
    '8B 40 2D 80 2C 3C 8D 0E' => 'AF-S DX VR Zoom-Nikkor 18-200mm f/3.5-5.6G IF-ED',
157
164
    '8C 40 2D 53 2C 3C 8E 06' => 'AF-S DX Zoom-Nikkor 18-55mm f/3.5-5.6G ED',
158
165
    '8D 44 5C 8E 34 3C 8F 0E' => 'AF-S VR Zoom-Nikkor 70-300mm f/4.5-5.6G IF-ED', #10
159
166
    '8F 40 2D 72 2C 3C 91 06' => 'AF-S DX Zoom-Nikkor 18-135mm f/3.5-5.6G IF-ED',
160
167
    '90 3B 53 80 30 3C 92 0E' => 'AF-S DX VR Zoom-Nikkor 55-200mm f/4-5.6G IF-ED',
 
168
    '93 48 37 5C 24 24 95 06' => 'AF-S Nikkor 24-70 f/2.8G ED',
161
169
    '94 40 2D 53 2C 3C 96 06' => 'AF-S DX Zoom-Nikkor 18-55mm f/3.5-5.6G ED II', #10 (D40)
 
170
    '96 48 98 98 24 24 98 0E' => 'AF-S Nikkor 400mm f/2.8G ED VR',
 
171
    '98 3C A6 A6 30 30 9A 0E' => 'AF-S Nikkor 600mm f/4G ED VR',
162
172
#
163
173
    '06 3F 68 68 2C 2C 06 00' => 'Cosina 100mm f/3.5 Macro',
164
174
#
165
175
    '26 48 11 11 30 30 1C 02' => 'Sigma 8mm F4 EX Circular Fisheye',
 
176
    '79 40 11 11 2C 2C 1C 06' => 'Sigma 8mm F3.5 EX', #19
166
177
    '48 3C 19 31 30 3C 4B 06' => 'Sigma 10-20mm F4-5.6 EX DC HSM',
167
178
    '48 38 1F 37 34 3C 4B 06' => 'Sigma 12-24mm F4.5-5.6 EX Aspherical DG HSM',
168
179
    '02 3F 24 24 2C 2C 02 00' => 'Sigma 14mm F3.5',
174
185
    '7F 48 2B 5C 24 34 1C 06' => 'Sigma 17-70mm F2.8-4.5 DC MACRO Asp. IF',
175
186
    '26 48 2D 50 24 24 1C 06' => 'Sigma 18-50mm F2.8 EX DC',
176
187
    '26 40 2D 50 2C 3C 1C 06' => 'Sigma 18-50mm F3.5-5.6 DC',
 
188
    '7A 40 2D 50 2C 3C 4B 06' => 'Sigma 18-50mm F3.5-5.6 DC HSM',
177
189
    '26 40 2D 70 2B 3C 1C 06' => 'Sigma 18-125mm F3.5-5.6 DC',
178
190
    '26 40 2D 80 2C 40 1C 06' => 'Sigma 18-200mm F3.5-6.3 DC',
179
191
    '26 58 31 31 14 14 1C 02' => 'Sigma 20mm F1.8 EX Aspherical DG DF RF',
201
213
    '7A 47 50 76 24 24 4B 06' => 'Sigma APO 50-150mm F2.8 EX DC HSM',
202
214
    '48 3C 50 A0 30 40 4B 02' => 'Sigma 50-500mm F4-6.3 EX APO RF HSM',
203
215
    '26 3C 54 80 30 3C 1C 06' => 'Sigma 55-200mm F4-5.6 DC',
 
216
    '7A 3B 53 80 30 3C 4B 06' => 'Sigma 55-200mm F4-5.6 DC HSM',
 
217
    '79 48 5C 5C 24 24 1C 06' => 'Sigma 70mm F2.8 EX DG Macro', #19
204
218
    '48 54 5C 80 24 24 4B 02' => 'Sigma 70-200mm F2.8 EX APO IF HSM',
 
219
    '02 46 5C 82 25 25 02 00' => 'Sigma 70-210mm F2.8 APO', #19
205
220
    '26 3C 5C 82 30 3C 1C 02' => 'Sigma 70-210mm F4-5.6 UC-II',
206
221
    '26 3C 5C 8E 30 3C 1C 02' => 'Sigma 70-300mm F4-5.6 DG MACRO',
207
222
    '56 3C 5C 8E 30 3C 1C 02' => 'Sigma 70-300mm F4-5.6 APO Macro Super II',
212
227
    '48 54 6F 8E 24 24 4B 02' => 'Sigma APO 120-300mm F2.8 EX DG HSM',
213
228
    '26 44 73 98 34 3C 1C 02' => 'Sigma 135-400mm F4.5-5.6 APO Aspherical',
214
229
    '48 48 76 76 24 24 4B 06' => 'Sigma 150mm F2.8 EX DG APO Macro HSM',
 
230
    '48 4C 7C 7C 2C 2C 4B 02' => 'Sigma 180mm F3.5 EX DG Macro', #19
215
231
    '26 40 7B A0 34 40 1C 02' => 'Sigma APO 170-500mm F5-6.3 ASPHERICAL RF',
216
232
    '48 4C 7D 7D 2C 2C 4B 02' => 'Sigma APO MACRO 180mm F3.5 EX DG HSM',
217
233
    '48 54 8E 8E 24 24 4B 02' => 'Sigma APO 300mm F2.8 EX DG HSM',
218
234
    '26 48 8E 8E 30 30 1C 02' => 'Sigma APO TELE MACRO 300mm F4',
219
235
    '48 3C 8E B0 3C 3C 4B 02' => 'Sigma APO 300-800 F5.6 EX DG HSM',
220
236
    '02 2F 98 98 3D 3D 02 00' => 'Sigma 400mm F5.6 APO',
 
237
    '02 37 A0 A0 34 34 02 00' => 'Sigma APO 500mm F4.5', #20
221
238
#
222
239
    '03 43 5C 81 35 35 02 00' => 'Soligor AF C/D ZOOM UMCS 70-210mm 1:4.5',
223
240
#
565
582
                TagTable => 'Image::ExifTool::Nikon::ShotInfo',
566
583
                ProcessProc => \&Image::ExifTool::Nikon::ProcessNikonEncrypted,
567
584
                DecryptStart => 4,
568
 
                DecryptLen => 0x90,
 
585
                DecryptLen => 0x24e,
569
586
            },
570
587
        },
571
588
        {
652
669
    ],
653
670
    0x0098 => [
654
671
        { #8
655
 
            Condition => '$$valPt =~ /^0100/',
 
672
            Condition => '$$valPt =~ /^0100/', # D100, D1X - PH
656
673
            Name => 'LensData0100',
657
674
            SubDirectory => {
658
675
                TagTable => 'Image::ExifTool::Nikon::LensData00',
659
676
            },
660
677
        },
661
678
        { #8
662
 
            Condition => '$$valPt =~ /^0101/',
 
679
            Condition => '$$valPt =~ /^0101/', # D70, D70s - PH
663
680
            Name => 'LensData0101',
664
681
            SubDirectory => {
665
682
                TagTable => 'Image::ExifTool::Nikon::LensData01',
667
684
        },
668
685
        # note: this information is encrypted if the version is 02xx
669
686
        { #8
670
 
            Condition => '$$valPt =~ /^020(1|2)/', # D80/D40 are version 0202 (PH)
 
687
            # 0201 - D200, D2Hs, D2X and D2Xs
 
688
            # 0202 - D40, D40X and D80
 
689
            # 0203 - D300
 
690
            Condition => '$$valPt =~ /^020[1-3]/',
671
691
            Name => 'LensData0201',
672
692
            Writable => 0, # can't yet write encrypted data
673
693
            SubDirectory => {
730
750
            TagTable => 'Image::ExifTool::Nikon::MultiExposure',
731
751
        },
732
752
    },
733
 
    0x00b1 => { #14
 
753
    0x00b1 => { #14/PH/19 (D80)
734
754
        Name => 'HighISONoiseReduction',
735
755
        Writable => 'int16u',
736
756
        PrintConv => {
737
757
            0 => 'Off',
738
 
            1 => 'On for ISO 1600/3200',
739
 
            2 => 'Weak',
 
758
            1 => 'Minimal', # for high ISO (>800) when setting is "Off"
 
759
            2 => 'Low',     # Low,Normal,High take effect for ISO > 400
740
760
            4 => 'Normal',
741
 
            6 => 'Strong',
 
761
            6 => 'High',
742
762
        },
743
763
    },
744
764
    # 0x00b2 (string: 'Normal', 0xc3's, 0xff's or 0x20's)
889
909
        },
890
910
    },
891
911
    2 => {
892
 
        Name => 'AFPointsUsed',
 
912
        Name => 'AFPointsInFocus',
893
913
        Format => 'int16u',
894
914
        PrintConv => {
895
915
            BITMASK => {
1063
1083
    CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
1064
1084
    WRITABLE => 1,
1065
1085
    FIRST_ENTRY => 0,
1066
 
    NOTES => 'This structure is used by the D100 and newer D1X models.',
 
1086
    NOTES => 'This structure is used by the D100, and D1X with firmware version 1.1.',
1067
1087
    GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
1068
1088
    0x00 => {
1069
1089
        Name => 'LensDataVersion',
1186
1206
    FIRST_ENTRY => 0,
1187
1207
    GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
1188
1208
    DATAMEMBER => [ 0 ],
1189
 
    NOTES => 'This information is encrypted for ShotInfoVersion 02xx.',
 
1209
    NOTES => q{
 
1210
        This information is encrypted for ShotInfoVersion 02xx, and some tags are
 
1211
        only valid for specific versions.
 
1212
    },
1190
1213
    0x00 => {
1191
1214
        Name => 'ShotInfoVersion',
1192
1215
        RawConv => '$$self{ShotInfoVersion} = $val',
1197
1220
        Condition => '$$self{ShotInfoVersion} =~ /^(0204)$/',
1198
1221
        Format => 'int8u',
1199
1222
        Unknown => 1,
 
1223
        Notes => 'D2X, D2Xs (unverified)',
1200
1224
        PrintConv => {
1201
 
            0 => 'VR off',
1202
 
            1 => 'VR on (normal)',
1203
 
            2 => 'VR on (active)',
 
1225
            0 => 'Off',
 
1226
            1 => 'On (normal)',
 
1227
            2 => 'On (active)',
1204
1228
        },
1205
1229
    },
1206
1230
    # 6a, 6e not correct for 0103 (D70), 0207 (D200)
1209
1233
        Condition => '$$self{ShotInfoVersion} =~ /^(0204)$/',
1210
1234
        Format => 'int32u',
1211
1235
        Priority => 0,
 
1236
        Notes => 'D2X, D2Xs',
1212
1237
    },
1213
1238
    0x6e => {
1214
1239
        Name => 'DeletedImageCount',
1215
1240
        Condition => '$$self{ShotInfoVersion} =~ /^(0204)$/',
1216
1241
        Format => 'int32u',
1217
1242
        Priority => 0,
1218
 
    },
1219
 
    0x82 => {
1220
 
        Name => 'VR_0x82',
 
1243
        Notes => 'D2X, D2Xs',
 
1244
    },
 
1245
    0x75 => { #19
 
1246
        Name => 'VibrationReduction',
 
1247
        Condition => '$$self{ShotInfoVersion} =~ /^(0207)$/',
 
1248
        Format => 'int8u',
 
1249
        Notes => 'D200',
 
1250
        PrintConv => {
 
1251
            0 => 'Off',
 
1252
            1 => 'On (1)',
 
1253
            2 => 'On (2)',
 
1254
        },
 
1255
    },
 
1256
    0x82 => { # educated guess, needs verification
 
1257
        Name => 'VibrationReduction',
1221
1258
        Condition => '$$self{ShotInfoVersion} =~ /^(0204)$/',
1222
1259
        Format => 'int8u',
1223
 
        Unknown => 1,
1224
 
        PrintConv => {
1225
 
            0 => 'VR off',
1226
 
            1 => 'VR on (normal)',
1227
 
            2 => 'code 2 (active?)',
1228
 
        },
1229
 
    },
1230
 
    # note: DecryptLen currently set to 0x90
 
1260
        Notes => 'D2X, D2Xs',
 
1261
        PrintConv => {
 
1262
            0 => 'Off',
 
1263
            1 => 'On',
 
1264
        },
 
1265
    },
 
1266
    0x157 => { #19
 
1267
        Name => 'ShutterCount',
 
1268
        Condition => '$$self{ShotInfoVersion} =~ /^(0205)$/',
 
1269
        Format => 'undef[2]',
 
1270
        Priority => 0,
 
1271
        Notes => 'D50',
 
1272
        # treat as a 2-byte big-endian integer
 
1273
        ValueConv => 'unpack("n", $val)',
 
1274
        ValueConvInv => 'pack("n",$val)',
 
1275
    },
 
1276
    0x1ae => { #19
 
1277
        Name => 'VibrationReduction',
 
1278
        Condition => '$$self{ShotInfoVersion} =~ /^(0205)$/',
 
1279
        Format => 'int8u',
 
1280
        Notes => 'D50',
 
1281
        PrintHex => 1,
 
1282
        PrintConv => {
 
1283
            0x00 => 'n/a',
 
1284
            0x0c => 'Off',
 
1285
            0x0f => 'On',
 
1286
        },
 
1287
    },
 
1288
    0x24a => { #19
 
1289
        Name => 'ShutterCount',
 
1290
        Condition => '$$self{ShotInfoVersion} =~ /^(0208)$/',
 
1291
        Format => 'int32u',
 
1292
        Priority => 0,
 
1293
        Notes => 'D80',
 
1294
    },
 
1295
    0x24e => { #19
 
1296
        Name => 'VibrationReduction',
 
1297
        Condition => '$$self{ShotInfoVersion} =~ /^(0208)$/',
 
1298
        Notes => 'D80',
 
1299
        PrintHex => 1,
 
1300
        PrintConv => {
 
1301
            0x00 => 'Off, Horizontal',
 
1302
            0x01 => 'Off, Rotated 270 CW',
 
1303
            0x02 => 'Off, Rotated 90 CW',
 
1304
            0x03 => 'Off, Rotated 180',
 
1305
            0x18 => 'On, Horizontal',
 
1306
            0x19 => 'On, Rotated 270 CW',
 
1307
            0x1a => 'On, Rotated 90 CW',
 
1308
            0x1b => 'On, Rotated 180',
 
1309
        },
 
1310
    },
 
1311
    # note: DecryptLen currently set to 0x24e
1231
1312
);
1232
1313
 
1233
1314
# Multi exposure / image overlay information (ref PH)
1609
1690
 
1610
1691
=item L<http://members.aol.com/khancock/pilot/nbuddy/>
1611
1692
 
1612
 
=item L<http://www.rottmerhusen.com/objektives/lensid/nikkor.html>
 
1693
=item L<http://www.rottmerhusen.com/objektives/lensid/thirdparty.html>
 
1694
 
 
1695
=item L<http://homepage3.nifty.com/kamisaka/makernote/makernote_nikon.htm>
1613
1696
 
1614
1697
=item L<http://www.wohlberg.net/public/software/photo/nstiffexif/>
1615
1698
 
1618
1701
=head1 ACKNOWLEDGEMENTS
1619
1702
 
1620
1703
Thanks to Joseph Heled, Thomas Walter, Brian Ristuccia, Danek Duvall, Tom
1621
 
Christiansen, Robert Rottmerhusen, Werner Kober and Roger Larsson for their
1622
 
help figuring out some Nikon tags.
 
1704
Christiansen, Robert Rottmerhusen, Werner Kober, Roger Larsson and Jens
 
1705
Duttke for their help figuring out some Nikon tags, and Bruce Stevens for
 
1706
his additions to the LensID list.
1623
1707
 
1624
1708
=head1 SEE ALSO
1625
1709