裁剪图像UIImage进行保存

时间:2013-12-07 01:14:47

标签: ios objective-c image uiimage

我有一个应用程序,允许用户将图像输入到应用程序中,另一个图像将显示在该图像的顶部。它提供了一个预览功能,可以显示它的外观。预览工作,应用程序也是如此,但是当我输入时,风景照片会变得模糊不清。我该如何解决这个问题? 这是用户输入的图像的代码。我相信这是造成问题的代码的一部分。

UIImage *bottomImage = imgBackGround.image; //background image
UIImage *image   = imgGradient.image; //foreground image
CGSize newSize;

if(IS_IPHONE_5)
 newSize = CGSizeMake(640, 1136);
else
 newSize = CGSizeMake(640, 960);

UIGraphicsBeginImageContextWithOptions(newSize, self.view.opaque, 0.0);
[[imgBackGround layer] renderInContext:UIGraphicsGetCurrentContext()];
UIImage*theImage=UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();

bottomImage = imgBackGround.image;

// bottomImage = [self imageByCropping:bottomImage toSize:newSize];

UIGraphicsBeginImageContext( newSize );

// Use existing opacity as is
[bottomImage drawInRect:CGRectMake(0,0,newSize.width,newSize.height)];

0 个答案:

没有答案