I am trying to crop image by my custom cropper. Not from the UIImagePickerController's. Now for that I am showing the Image captured from Image Picker in a UIImgeView by handling UIImagePicker's delegate:
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingImage:(UIImage *)image editingInfo:(NSDictionary *)editingInfo {
imvOriginalImage.image = image;
}
For cropping I have to convert this Image to CGImageRef. The Image is captured in portrait mode. Now when I convert this image in CGImageRef image orientation get changed. Even if I use following:
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingImage:(UIImage *)image editingInfo:(NSDictionary *)editingInfo {
//imvOriginalImage.image = image;
CGImageRef imgRef = [image CGImage];
UIImage *img = [UIImage imageWithCGImage:imgRef];
[imvOriginalImage setImage:img];
}
Image Orientation get changed. This happens only for those Image which are captured in portrait mode. Landscape images not have this issue.
Thanks In Advance.
This is that iPhone camera rotates the image comparing with Home button. It uses EXIF that is meta data of image. See this thread:
iPhone image rotation
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With