2015-10-28 31 views
2

我有一些代碼在那裏我抓住了屏幕的圖像,然後裁剪它基於一些邊界值:我抓住屏幕的圖像然後裁剪它後失去分辨率?

UIGraphicsBeginImageContextWithOptions(self.mainView.bounds.size, NO, 0.0); 
[self.mainView.layer renderInContext:UIGraphicsGetCurrentContext()]; 
UIImage *comicImage = UIGraphicsGetImageFromCurrentImageContext(); 
UIGraphicsEndImageContext(); 

UIGraphicsBeginImageContextWithOptions(CGSizeMake(boundary.width, boundary.height), NO, 0.0); 
[comicImage drawAtPoint:CGPointMake(-boundary.xMin, -boundary.yMin)]; 
comicImage = UIGraphicsGetImageFromCurrentImageContext(); 
UIGraphicsEndImageContext(); 

什麼我不知道的,我是生產低質量差的形象使用上述方法的分辨率?有沒有更好的方式去做這件事?

+0

我有同樣的問題。採取截圖和裁剪它總是使質量差。找不到任何其他選項。 –

回答

1

也許,你可以使用如下代碼

UIGraphicsBeginImageContextWithOptions(size, NO, [UIScreen mainScreen].scale);