Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save maxkramer/3024184 to your computer and use it in GitHub Desktop.
Save maxkramer/3024184 to your computer and use it in GitHub Desktop.
UIImagePicker Image Orientation Normalizer
- (UIImage *)normalizedImage {
if (self.imageOrientation == UIImageOrientationUp) return self;
UIGraphicsBeginImageContextWithOptions(self.size, NO, self.scale);
[self drawInRect:(CGRect){0, 0, self.size}];
UIImage *normalizedImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return normalizedImage;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment