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.