困惑的UIImageOrientation肖像/风景模式照片 [英] confused by the UIImageOrientation of portrait/landscape mode photo
问题描述
我使用ios的系统相机拍摄了两张照片,其中一张处于纵向模式,另一张处于横向模式,然后我使用imagePicker在我的应用中选择它们:
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);
}
注意我NSLog出图像的UIImageOrientation值我刚挑出来。
结果是肖像模式照片的值是3 (代表UIImageOrientationRight)和横向模式照片是0 (UIImageOrientationUp)我只是不明白为什么。有人可以解释一下吗?谢谢!
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!
推荐答案
iPhone的相机保存照片,无论设备方向如何,但它会为图像添加元信息,以便正确渲染此图像。 imageOrientation
描述了应该旋转图像以正确渲染的度数。
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.
这篇关于困惑的UIImageOrientation肖像/风景模式照片的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!