28分钟后,我明白了这一点,哦,好吧,就这样:
CGImageRef imageRef = CGImageCreateWithImageInRect([imageTaken CGImage], CGRectMake(0.0f, 0.0f, 960.0f, 960.0f));
[selectedImageView setImage:[UIImage imageWithCGImage:imageRef]];
CGImageRelease(imageRef);
通过在
960.0f
我能够保持图片的原始质量,也能够分辨出
Y
我可以把它从中“剪下来”。我还添加了以下内容:
+ (UIImage*)rotate:(UIImage*)image andOrientation:(UIImageOrientation)orientation;
{
UIGraphicsBeginImageContext(image.size);
CGContextRef context=(UIGraphicsGetCurrentContext());
if (orientation == UIImageOrientationRight) {
CGContextRotateCTM (context, 90/180*M_PI) ;
} else if (orientation == UIImageOrientationLeft) {
CGContextRotateCTM (context, -90/180*M_PI);
} else if (orientation == UIImageOrientationDown) {
// NOTHING
} else if (orientation == UIImageOrientationUp) {
CGContextRotateCTM (context, 90/180*M_PI);
}
[image drawAtPoint:CGPointMake(0, 0)];
UIImage *img=UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return img;
}
因为图片向左旋转。