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
28 lines
1.1 KiB
C#
28 lines
1.1 KiB
C#
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,
|
||
};
|
||
}
|
||
}
|