I'm having problems orienting images properly on the iPhone. I'm accessing the images using the AssetLibrary classes.
All, I want to do is properly orient the images for display, unfortunately for some images that are taken in portrait mode, they are in an orientation that doesn't make sense.
In the block that's called by the framework, I'm making the following calls for a picture that was taken by the iPhone camera in while it was oriented 'Up':
ALAssetRepresentation *representation = [myasset defaultRepresentation];
ALAssetOrientation orient = [representation orientation];
ALAssetOrientation alorient = [[myasset valueForProperty:@"ALAssetOrientation"] intValue];
UIImage *timg = [[UIImage alloc] initWithCGImage:[representation fullScreenImage]];
UIImageOrientation imgorient = [timg imageOrientation];
THe variable orient = ALAssetOrientationRight.
The variable alorient = ALAssetOrientationUp.
The variable imgorient = UIImageOrientationUp
I was using the orient value to rotate the image so that it appears 'up'. Unfortunately, if I have an image that's taken in landscape mode the same code doesn't work because the orientations are incorrect.
I've tried instantiating timg using the scale:orientation: overload using orient for the orientation parameter, all it does is initialize the image setting the orientation but incorrectly rotates the image.
This seems non deterministic, how come these calls return different results:
ALAssetOrientation orient = [representation orientation];
ALAssetOrientation alorient = [[myasset valueForProperty:@"ALAssetOrientation"] intValue];
Your help will be greatly appreciated.
Thanks, Will