UIImage imageOrientation总是与实际拍摄照片的方式相反

时间:2014-01-31 22:01:44

标签: ios iphone ios7 uiimage uiimagepickercontroller

我遇到一个奇怪的问题,我的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的读出,这似乎表明图像 采取肖像。这是怎么回事?

谢谢!

0 个答案:

没有答案