我遇到一个奇怪的问题,我的image.imageOrientation
似乎总是与拍摄照片的方式相反。例如,当我将iPhone 5竖立起来拍照时,结果image.imageOrientation
总是说“风景”,反之亦然。
以下是拍摄照片和检查图像方向的代码:
if ([mediaType isEqualToString:(NSString *)kUTTypeImage]){
//A photo was taken
self.imageTakenOrSelected = [info objectForKey:UIImagePickerControllerOriginalImage];
if (self.imageTakenOrSelected.imageOrientation == UIImageOrientationUp) {
NSLog(@"!------portrait");
} else if (self.imageTakenOrSelected.imageOrientation == UIImageOrientationLeft || self.imageTakenOrSelected.imageOrientation == UIImageOrientationRight) {
NSLog(@"!------landscape");
}
NSLog(@"self.imageTaken width: %f, and height %f", self.imageTakenOrSelected.size.width, self.imageTakenOrSelected.size.height);
}
例如,当我直接拍照时,我总是会看到“风景”的NSLog,以及self.imageTaken width: 2448.000000, and height 3264.000000
的读出,这似乎表明图像 采取肖像。这是怎么回事?
谢谢!