Skip to content

feat(makernote): add Canon MakerNote parser (MNI-2)#32

Closed
rpuneet wants to merge 2 commits intomainfrom
feat/mni-2-canon-parser
Closed

feat(makernote): add Canon MakerNote parser (MNI-2)#32
rpuneet wants to merge 2 commits intomainfrom
feat/mni-2-canon-parser

Conversation

@rpuneet
Copy link
Contributor

@rpuneet rpuneet commented Feb 7, 2026

Summary

Canon MakerNote Format

  • No header - IFD starts immediately at offset 0
  • Byte order inherited from parent EXIF
  • Offsets are absolute (relative to EXIF TIFF header)

Key Tags Supported

  • CameraSettings1/2 - Camera configuration arrays
  • ImageType, SerialNumber, LensModel, ModelID
  • FirmwareVersion, OwnerName
  • ColorData, VignettingCorrection, LightingOptimizer

Test plan

  • Unit tests for Canon handler (Detect, Parse, TagName)
  • Integration tests verify 28 Canon tags from CR2 files
  • All existing tests pass (go test ./...)

Verification

make build && ./bin/imx testdata/cr2/sample1.cr2 | grep -i canon

🤖 Generated with Claude Code

rpuneet and others added 2 commits February 7, 2026 23:10
Implements MNI-1 (Issue #10) - the foundation for manufacturer-specific
MakerNote parsing in the TIFF/EXIF metadata pipeline.

## New Package: internal/parser/tiff/makernote/

- Handler interface: Manufacturer(), Detect(), Parse(), TagName()
- Config struct: IFDOffset, OffsetBase, ByteOrder, HasNextIFD, Variant
- Registry pattern with ordered detection for manufacturer routing
- Detection functions for all major manufacturers:
  - Nikon Type 3: 'Nikon' + 0x02 (embedded TIFF header)
  - Nikon Type 1: 'Nikon' + 0x01
  - Sony: 'SONY DSC' or 'SONY CAM' (12-byte header)
  - Fujifilm: 'FUJIFILM' (8-byte header + offset)
  - Canon: No header (IFD validation fallback)

## TIFF Parser Integration

- Added handleMakerNote() to ifd.go for TagMakerNote (0x927C)
- Integrated makernote.Registry into Parser struct
- Preserves backward compatibility: returns raw MakerNote when
  no handler matches

## Offset Handling

- OffsetAbsolute: Canon, Nikon T1/T2, Sony (relative to TIFF base)
- OffsetRelativeToMakerNote: Fujifilm, Nikon T3

Closes #10

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Implement Canon-specific MakerNote parsing with support for 35+ tag types
including CameraSettings, ImageType, SerialNumber, LensModel, and ModelID.

Canon MakerNote format:
- No header - IFD starts immediately at offset 0
- Byte order inherited from parent EXIF
- Offsets are absolute (relative to EXIF TIFF header)

Changes:
- Add canon/canon.go with Parse() implementation for IFD parsing
- Add canon/tags.go with tag constants and name mappings
- Add canon/canon_test.go with comprehensive unit tests
- Register Canon handler in tiff.go (last priority, fallback detection)
- Update integration test to verify 28 Canon tags from CR2 files

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@rpuneet
Copy link
Contributor Author

rpuneet commented Feb 8, 2026

Closing as obsolete - Canon parser already merged via PR #24. All Canon MakerNote functionality is in main.

@rpuneet rpuneet closed this Feb 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: Canon MakerNote parser not registered in tiff.go

1 participant