Skip to content

Commit c19be2b

Browse files
rpuneetclaude
andauthored
feat(makernote/nikon): implement Nikon MakerNote parser (#27)
Adds support for Nikon Type 1 and Type 3 MakerNote formats: Type 1 (older cameras like D1, D100): - 8-byte header: 'Nikon\x00\x01\x00' - Absolute offsets (relative to EXIF TIFF header) - Inherits byte order from parent Type 3 (modern cameras like D3, D700, Z series): - 10-byte header + embedded TIFF header - Relative offsets (to MakerNote start) - Own byte order from embedded TIFF Encrypted tags (LensData 0x0098, FlashInfo 0x00A8) are skipped. Co-authored-by: Claude Opus 4.5 <[email protected]>
1 parent c08e7c9 commit c19be2b

File tree

4 files changed

+933
-0
lines changed

4 files changed

+933
-0
lines changed
Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
package nikon
2+
3+
// nikonTagNames maps Nikon MakerNote tag IDs to human-readable names.
4+
// Based on ExifTool Nikon tag documentation.
5+
var nikonTagNames = map[uint16]string{
6+
// Basic info (common across Nikon cameras)
7+
0x0001: "MakerNoteVersion",
8+
0x0002: "ISO",
9+
0x0003: "ColorMode",
10+
0x0004: "Quality",
11+
0x0005: "WhiteBalance",
12+
0x0006: "Sharpness",
13+
0x0007: "FocusMode",
14+
0x0008: "FlashSetting",
15+
0x0009: "FlashType",
16+
0x000B: "WhiteBalanceFineTune",
17+
0x000C: "WB_RBLevels",
18+
0x000D: "ProgramShift",
19+
0x000E: "ExposureDifference",
20+
0x000F: "ISOSelection",
21+
0x0010: "DataDump",
22+
0x0011: "PreviewIFD",
23+
0x0012: "FlashExposureComp",
24+
0x0013: "ISOSetting",
25+
0x0014: "ColorBalanceA",
26+
0x0016: "ImageBoundary",
27+
0x0017: "ExternalFlashExposureComp",
28+
0x0018: "FlashExposureBracketValue",
29+
0x0019: "ExposureBracketValue",
30+
0x001A: "ImageProcessing",
31+
0x001B: "CropHighSpeed",
32+
0x001C: "ExposureTuning",
33+
0x001D: "SerialNumber",
34+
0x001E: "ColorSpace",
35+
0x001F: "VRInfo",
36+
0x0020: "ImageAuthentication",
37+
0x0021: "FaceDetect",
38+
0x0022: "ActiveD-Lighting",
39+
0x0023: "PictureControlData",
40+
0x0024: "WorldTime",
41+
0x0025: "ISOInfo",
42+
0x002A: "VignetteControl",
43+
0x002B: "DistortInfo",
44+
0x002C: "UnknownInfo",
45+
46+
// Lens and focus
47+
0x0080: "ImageAdjustment",
48+
0x0081: "ToneComp",
49+
0x0082: "AuxiliaryLens",
50+
0x0083: "LensType",
51+
0x0084: "Lens",
52+
0x0085: "ManualFocusDistance",
53+
0x0086: "DigitalZoom",
54+
0x0087: "FlashMode",
55+
0x0088: "AFInfo",
56+
0x0089: "ShootingMode",
57+
0x008A: "AutoBracketRelease",
58+
0x008B: "LensFStops",
59+
0x008C: "ContrastCurve",
60+
0x008D: "ColorHue",
61+
0x008F: "SceneMode",
62+
0x0090: "LightSource",
63+
0x0091: "ShotInfo",
64+
0x0092: "HueAdjustment",
65+
0x0093: "NEFCompression",
66+
0x0094: "Saturation",
67+
0x0095: "NoiseReduction",
68+
0x0096: "LinearizationTable",
69+
0x0097: "ColorBalance",
70+
0x0098: "LensData", // Encrypted
71+
0x0099: "RawImageCenter",
72+
0x009A: "SensorPixelSize",
73+
0x009C: "SceneAssist",
74+
0x009E: "RetouchHistory",
75+
0x00A0: "SerialNumber",
76+
0x00A2: "ImageDataSize",
77+
0x00A5: "ImageCount",
78+
0x00A6: "DeletedImageCount",
79+
0x00A7: "ShutterCount",
80+
0x00A8: "FlashInfo", // Encrypted
81+
0x00A9: "ImageOptimization",
82+
0x00AA: "Saturation",
83+
0x00AB: "VariProgram",
84+
0x00AC: "ImageStabilization",
85+
0x00AD: "AFResponse",
86+
0x00B0: "MultiExposure",
87+
0x00B1: "HighISONoiseReduction",
88+
0x00B3: "ToningEffect",
89+
0x00B6: "PowerUpTime",
90+
0x00B7: "AFInfo2",
91+
0x00B8: "FileInfo",
92+
0x00B9: "AFTune",
93+
0x00BB: "RetouchInfo",
94+
0x00BD: "PictureControlData",
95+
0x00C3: "BarometerInfo",
96+
97+
// Preview
98+
0x0100: "DigitalICE",
99+
0x0103: "PreviewCompression",
100+
0x0201: "PreviewImageStart",
101+
0x0202: "PreviewImageLength",
102+
103+
// Capture and scene info
104+
0x0E00: "PrintIM",
105+
0x0E01: "NikonCaptureData",
106+
0x0E09: "NikonCaptureVersion",
107+
0x0E0E: "NikonCaptureOffsets",
108+
0x0E10: "NikonScanIFD",
109+
0x0E13: "NikonCaptureEditVersions",
110+
0x0E1D: "NikonICCProfile",
111+
0x0E1E: "NikonCaptureOutput",
112+
0x0E22: "NEFBitDepth",
113+
}

0 commit comments

Comments
 (0)