Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP


Orientation issue on iOS5 #33

polyclick opened this Issue · 2 comments

3 participants


Hi, I'm using your component for an iOS5 project and stumbled upon some orientation problems. Some images appeared to be upside down.

I saw in the commit log that you removed your orientation fix, probably because it wasn't working 100%. But I think I found the fix:

In ELCImagePickerController.m change:

[workingDictionary setObject:[UIImage imageWithCGImage:[[asset defaultRepresentation] fullScreenImage]] forKey:@"UIImagePickerControllerOriginalImage"];


// Retrieve the image orientation from the ALAsset
UIImageOrientation orientation = UIImageOrientationUp;
NSNumber* orientationValue = [asset valueForProperty:@"ALAssetPropertyOrientation"];
if(orientationValue != nil) orientation = [orientationValue intValue];

[workingDictionary setObject:[UIImage imageWithCGImage:[[asset defaultRepresentation] fullResolutionImage] scale:1.0 orientation:orientation] forKey:@"UIImagePickerControllerOriginalImage"];

The [UIImage imageWithCGImage:scale:orientation] method appears to want UIImageOrientationUp to be passed in for the orientation, to return an image that is properly rotated. Some images may still be incorrectly rotated, but that would be more of an issue with the metadata on the image, than passing in a particular orientation value. This change was implemented in: 1f7e4e4

@jvanmetre jvanmetre closed this

"In iOS 5 and later, this method returns a fully cropped, rotated, and adjusted image—exactly as a user would see in Photos or in the image picker."

    CGImageRef imgRef = [assetRep fullScreenImage];
    UIImage *img = [UIImage imageWithCGImage:imgRef
                                orientation:UIImageOrientationUp ];

or use fullResolutionImage method

    CGImageRef imgRef = [assetRep  fullResolutionImage];
    UIImage *img = [UIImage imageWithCGImage:imgRef
                                orientation:(UIImageOrientation)assetRep.orientation ];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.