Question

I take two photos using the ios`s system camera,which one is in portrait mode and another is in landscape mode, then I use imagePicker to pick them out in my app like this:

-(void) imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info{

    UIImage* sourceImage = [info objectForKey:UIImagePickerControllerOriginalImage];


    UIImageOrientation imageOrientation = sourceImage.imageOrientation;
    NSLog(@"%d",imageOrientation);

}

Note that I NSLog out the UIImageOrientation value of the image I just picked out. the result is the value for the portrait mode photo is 3(which represents UIImageOrientationRight) and the landscape mode photo is 0 (UIImageOrientationUp) I just do not understand why. can anyone explain that? thanks!

Was it helpful?

Solution

iPhone's camera save photo regardless to the device orientation but it adds a metainformation to image to allow this image rendered properly. imageOrientation describes the amount of degrees the image should be rotated to be properly rendered.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top