UIImagePickerController returning incorrect image orientation

前端 未结 6 1974
北荒
北荒 2020-12-25 08:10

I\'m using UIImagePickerController to capture an image and then store it. However, when i try to rescale it, the orientation value i get out of this image is incorrect. When

6条回答
  •  既然无缘
    2020-12-25 09:05

    This what I have found for fixing orientation issue; Works for me

    UIImage *initialImage = [info objectForKey:@"UIImagePickerControllerOriginalImage"];
    NSData *data = UIImagePNGRepresentation(self.initialImage);
    
    UIImage *tempImage = [UIImage imageWithData:data];
    UIImage *fixedOrientationImage = [UIImage imageWithCGImage:tempImage.CGImage
                                         scale:initialImage.scale
                                   orientation:self.initialImage.imageOrientation];
    initialImage = fixedOrientationImage;
    

提交回复
热议问题