Enum ImageOrientation
How stored pixels must be turned to show the image upright: the EXIF Orientation tag (274). The value says which way the camera
was held; AutoOrient applies it.
public enum ImageOrientation
Fields
FlipHorizontal = 2Mirrored left to right (EXIF 2).
FlipVertical = 4Mirrored top to bottom (EXIF 4).
Normal = 1Stored upright (EXIF 1). Also used when a file says nothing.
Rotate180 = 3Upside down (EXIF 3).
Rotate270 = 8Needs a 270° clockwise turn to show upright (EXIF 8).
Rotate90 = 6Needs a 90° clockwise turn to show upright (EXIF 6), as from a phone held upright.
Transpose = 5Mirrored along the top-left to bottom-right diagonal (EXIF 5).
Transverse = 7Mirrored along the top-right to bottom-left diagonal (EXIF 7).
Unknown = 0Not a valid EXIF value; treated as Normal. Readers report Normal when a file says nothing.
Examples
// Load returns pixels as stored. A phone photo stored sideways says so in its EXIF orientation.
RasterInfo info = Raster.Probe("sideways.jpg");
Console.WriteLine(info.Orientation); // Rotate90
// AutoOrient turns the pixels upright and resets the tag. Followed by a resize, the resize runs first, on the stored image,
// so only the small result is turned.
using Raster photo = Raster.Load("sideways.jpg");
photo.Apply(ops => ops.AutoOrient().Fit(300, 300), Ct);