Last active
December 17, 2015 02:19
-
-
Save Splat/5534678 to your computer and use it in GitHub Desktop.
Monotouch normalize image to orientation for shipping to external applications | servers which may not respect the EXIF data.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static UIImage RotateImage (this UIImage image) | |
{ | |
if (image.Orientation == UIImageOrientation.Up) return image; | |
UIGraphics.BeginImageContextWithOptions(image.Size, false, image.CurrentScale); | |
iimage.DrawAsPatternInRect(new RectangleF(0, 0, image.Size.Width, image.Size.Height)); | |
UIImage normalizedImage = UIGraphics.GetImageFromCurrentImageContext(); | |
UIGraphics.EndImageContext(); | |
return normalizedImage; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment