Enum ExifType
The TIFF data types EXIF values are stored as.
[SuppressMessage("Naming", "CA1720:Identifier contains type name", Justification = "These are the TIFF specification's type names.")]
public enum ExifType
Fields
Ascii = 2Text, ending with a zero byte.
Byte = 18-bit unsigned integers.
Double = 1264-bit floating point numbers.
Float = 1132-bit floating point numbers.
Long = 432-bit unsigned integers.
Rational = 5Pairs of 32-bit unsigned integers: numerator and denominator.
SByte = 68-bit signed integers.
SLong = 932-bit signed integers.
SRational = 10Pairs of 32-bit signed integers: numerator and denominator.
SShort = 816-bit signed integers.
Short = 316-bit unsigned integers.
Undefined = 7Bytes whose meaning depends on the tag.
Examples
using Raster photo = Raster.Load("sideways.jpg");
ExifData exif = photo.Metadata.Exif ?? new ExifData();
// Typed values go in with their EXIF type; fractions are exact numerator / denominator pairs.
exif.Set(ExifKey.ExposureTime, new ExifFraction(1, 250));
exif.Set(ExifKey.Artist, "A. Photographer");
if (exif.TryGet(ExifKey.ExposureTime, out ExifEntry? entry) && entry.Type == ExifType.Rational)
{
Console.WriteLine($"Exposure {entry.AsFraction()} s = {entry.AsFraction().ToDouble()} s, in the {entry.Key.Ifd} IFD");
}
if (exif.Location is GeoPosition where)
{
Console.WriteLine($"Taken at {where.Latitude:F5}, {where.Longitude:F5}");
}