0
我從最近幾小時使用Google搜索並獲得裁剪圖片的解決方案,但我很困惑,想知道這兩者之間有什麼區別?裁剪圖片目標C
問題:我想從圖像中裁剪一個矩形圖像,我已經檢測到邊界。
第一:
CGRect rect = CGRectMake(0,0,320, 460);
// Create bitmap image from original image data,
// using rectangle to specify desired crop area
CGImageRef imageRef = CGImageCreateWithImageInRect([imageView.image CGImage], rect);
UIImage *imgs = [UIImage imageWithCGImage:imageRef];
CGImageRelease(imageRef);
二:
CGRect rect = [backView bounds];
UIGraphicsBeginImageContext(rect.size);
CGContextRef context = UIGraphicsGetCurrentContext();
[backView.layer renderInContext:context];
UIImage *viewImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
看看在這些鏈接http://stackoverflow.com/questions/9578821/iphonehow-to-crop-image-in-ios5和http://stackoverflow.com/questions/7950719/how-to-crop-the-image-in -蘋果手機 – Venkat