【发布时间】:2014-01-15 23:44:50
【问题描述】:
我正在开发我的照片应用程序,但我遇到了最终保存的图像质量较差的问题。我不确定如何使图像质量与我在屏幕上看到的相匹配(在保存到相机胶卷之前)。当我打开保存的图像时,它是像素化/模糊的。这是我的代码,任何见解将不胜感激:
CGRect grabRect ;
if (self.view.frame.size.height==460) {
grabRect = CGRectMake(30,50,260,257);
}
else{
grabRect = CGRectMake(3,50,314,315);
}
//for retina displays
NSLog(@"save......");
if ([[UIScreen mainScreen] respondsToSelector:@selector(scale)]) {
UIGraphicsBeginImageContextWithOptions(grabRect.size, NO, [UIScreen mainScreen].scale);
} else {
UIGraphicsBeginImageContext(grabRect.size);
}
CGContextRef ctx = UIGraphicsGetCurrentContext();
CGContextTranslateCTM(ctx, -grabRect.origin.x, -grabRect.origin.y);
[self.view.layer renderInContext:ctx];
UIImage *viewImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
【问题讨论】:
-
对不起,我试过了,但没有任何区别。
-
您是说在保存到相机胶卷之前模糊,还是在将其保存到相机胶卷并使用iOS图片应用打开它之后然后i> 看起来很模糊?
-
保存到相机胶卷后。它在应用程序中完全没问题,但是在保存并在相机胶卷中打开时质量会降低。它不是非常模糊,只是一点点,但足以惹恼我。
标签: ios objective-c uiimage