我正在尝试通过自定义裁剪器裁剪图像。不是来自UIImagePickerController的。为此我通过处理UIImagePicker的委托来显示从UIImgeView中的图像选择器捕获的图像:
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingImage:(UIImage *)image editingInfo:(NSDictionary *)editingInfo {
imvOriginalImage.image = image;
}
对于裁剪,我必须将此Image转换为CGImageRef。以纵向模式捕获图像。现在,当我在CGImageRef中转换此图像时,图像方向会发生变化。即使我使用以下内容:
- (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];
}
图像方向发生变化。这仅适用于以纵向模式拍摄的图像。风景图片没有这个问题。
提前致谢。