Question

Is it possible to strip or completely remove UIImageOrientation information from a UIImage?

Can I set image.imageOrientation = nil or to nothing?

I want to physically rotate my image and strip the orientation.

Was it helpful?

Solution

You can not set to nil the imageOrientation since it's not an object. You could find it in the UIImage header definition file and you'll find it's defined as a NSInteger

typedef NS_ENUM(NSInteger, UIImageOrientation)

Apart from being a NSInteger the property associate to it is readonly, which means you can not change it directly through setter method:

@property(nonatomic,readonly) UIImageOrientation imageOrientation;

UIImageOrientationUp is the default orientation for UIImage, what you could do is to create a new image with the orientation you want to use/prefer using for example:

+ (UIImage *)imageWithCGImage:(CGImageRef)cgImage scale:(CGFloat)scale orientation:(UIImageOrientation)orientation NS_AVAILABLE_IOS(4_0);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top