Table of Contents

Enum ExifType

Namespace
Egami.Metadata
Assembly
Egami.dll

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 = 2

Text, ending with a zero byte.

Byte = 1

8-bit unsigned integers.

Double = 12

64-bit floating point numbers.

Float = 11

32-bit floating point numbers.

Long = 4

32-bit unsigned integers.

Rational = 5

Pairs of 32-bit unsigned integers: numerator and denominator.

SByte = 6

8-bit signed integers.

SLong = 9

32-bit signed integers.

SRational = 10

Pairs of 32-bit signed integers: numerator and denominator.

SShort = 8

16-bit signed integers.

Short = 3

16-bit unsigned integers.

Undefined = 7

Bytes 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}");
}