feat(metadata): parse TIFF/Exif, JPEG segments and MakerNotes

ExifParser walks IFD0, Exif, GPS and SubIFDs, selects the main raster
(largest full-resolution IFD), and enumerates embedded JPEG previews
(JPEGInterchangeFormat, single-strip/tile Compression 6/7, lossless
raw strips excluded). JpegParser scans APP1 Exif/XMP/extended XMP,
APP2 MPF large thumbnails and SOFn up to SOS, tolerating fill bytes
and garbage. Vendor MakerNotes (Canon, Nikon, Sony, Fujifilm,
Olympus/OM, Panasonic) fill serial, lens, shutter count, stabiliser,
ISO and colour temperature only when standard tags did not.
TiffTags gains GPSVersionID, GPSStatus, YCbCrPositioning,
StandardOutputSensitivity and ISOSpeed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012iLMBNwBE2GnphAsu4cjaC
This commit is contained in:
Claude committed 2026-10-02 10:01:12 +00:00
1 parent 654c45a274
commit d12c0b41c5
11 files changed
+918

No files matched your search

@@ -0,0 +1,27 @@
using Titano.Core.Metadata.Tiff;
namespace Titano.Core.Metadata.MakerNotes;
/// <summary>Panasonic MakerNote: "Panasonic\0\0\0" then an IFD whose offsets are relative to the Exif TIFF.</summary>
internal static class PanasonicMakerNote
{
private const ushort ImageStabilization = 0x001A;
private const ushort InternalSerialNumber = 0x0025;
private const ushort ColorTempKelvin = 0x0044;
private const ushort LensType = 0x0051;
public static void Parse(TiffReader r, Ifd ifd, MetadataBuilder m)
{
var v = m.MakerNote;
v.BodySerial ??= IfdValue.String(r, ifd, InternalSerialNumber);
v.LensModel ??= IfdValue.String(r, ifd, LensType);
v.ColorTemperature ??= IfdValue.Int(r, ifd, ColorTempKelvin) is { } kelvin and > 0 and < 65535 ? kelvin : null;
// 3 = off; 2, 4–7, 9–12 = optical/body/dual IS modes.
v.ImageStabilization ??= IfdValue.UInt(r, ifd, ImageStabilization) switch
{
3 => false,
2 or (>= 4 and <= 7) or (>= 9 and <= 12) => true,
_ => null,
};
}
}