您可以使用通過UIImagePickerControllerCropRect
提供的值手動裁剪UIImagePickerControllerOriginalImage
。
未經測試的快速和骯髒的例子:
static UIImage *my_croppedImage(UIImage *image, CGRect cropRect)
{
UIGraphicsBeginImageContext(cropRect.size);
[image drawAtPoint:CGPointMake(-cropRect.origin.x, -cropRect.origin.y)];
UIImage *cropped = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return cropped;
}
- (void) imagePickerController:(UIImagePickerController *)picker
didFinishPickingMediaWithInfo:(NSDictionary *)info
{
// …
UIImage *originalImage = info[UIImagePickerControllerOriginalImage];
CGRect cropRect = [info[UIImagePickerControllerCropRect] CGRectValue];
UIImage *croppedImage = my_croppedImage(originalImage, cropRect);
// …
}
你找到如何解決降低圖像的質量對其進行編輯後的問題? – Sawsan 2013-06-04 14:04:36