Menu
  • HOME
  • TAGS

iOS UIImage: set image orientation without rotating the image itself

ios,image,uiimage,uiimageorientation

- (UIImage *)removeRotationForImage:(UIImage*)image { if (image.imageOrientation == UIImageOrientationUp) return image; UIGraphicsBeginImageContextWithOptions(image.size, NO, image.scale); [image drawInRect:(CGRect){0, 0, image.size}]; UIImage *normalizedImage = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); return normalizedImage; } ...