被纵向/横向模式照片的UIImageOrientation困惑

我使用ios的系统相机拍摄两张照片,一张是纵向模式,另一张是横向模式,然后使用imagePicker在我的应用中挑选出来:

-(void) imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info{ UIImage* sourceImage = [info objectForKey:UIImagePickerControllerOriginalImage]; UIImageOrientation imageOrientation = sourceImage.imageOrientation; NSLog(@"%d",imageOrientation); } 

请注意,我注销了我刚刚挑出的图像的UIImageOrientation值。 结果是肖像模式照片的值是3 (它代表UIImageOrientationRight)和风景模式照片是0 (UIImageOrientationUp)我只是不明白为什么。 谁能解释一下吗? 谢谢!

iPhone的相机保存照片,不pipe设备的方向,但它增加了一个元信息的形象,让这个图像正确渲染。 imageOrientation描述了图像应该被旋转以正确呈现的度数。