private RotateFlipType? GetRotateFlipType(ImageFactory factory)
{
const int Orientation = (int)ExifPropertyTag.Orientation;
if (factory.PreserveExifData && factory.ExifPropertyItems.ContainsKey(Orientation))
{
int rotationValue = factory.ExifPropertyItems[Orientation].Value[0];
switch (rotationValue)
{
case 8: // Rotated 90 right
// De-rotate:
return RotateFlipType.Rotate270FlipNone;
case 3: // Bottoms up
return RotateFlipType.Rotate180FlipNone;
case 6: // Rotated 90 left
return RotateFlipType.Rotate90FlipNone;
}
}
return null;
}