confused by the UIImageOrientation of portrait/landscape mode photo
Asked Answered
K

1

4

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!

Kaden answered 29/7, 2013 at 10:33 Comment(3)
Check out this topic #10850684Nereid
This question brought me to the correct answer. That aught to account for an up-vote.Shaunda
That question was down-voted for no valid reason. It's a perfectly valid questionViolent
N
3

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.

Nereid answered 29/7, 2013 at 11:32 Comment(3)
Thanks @Max K.! so the UIImageOrientationRight for portrait photo means the system has to rotate the image CCW 90 degree to render it properly?Kaden
Yes, please, look at the UIImage reference for more information developer.apple.com/library/ios/#documentation/UIKit/Reference/…. Read carefully to understand what those constants actually mean.Nereid
it's incredibly confusing/strange that it seems to save as a landscape?? so the always-default portrait mode is UIImageOrientationRight. I think.Gass

© 2022 - 2024 — McMap. All rights reserved.