我正在处理我的照片应用程序,并且出现质量较差的最终保存图像时出现问题。我不知道如何才能使图像质量与我在屏幕上看到的图像质量相匹配(保存到相机胶卷之前)。当我打开保存的图像时,它是像素化/模糊的。这里是我的代码,任何见解将不胜感激:保存后UIImage质量差
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();
对不起,我试过了,它没有任何区别。 – dfox
你是说这是模糊*之前*你保存到相机胶卷,或者在你将它保存到相机胶卷并使用iOS Pictures应用程序打开它*然后*它看起来模糊? –
我保存到相机胶卷后。在应用程序中完全没问题,但保存并在相机胶卷中打开时质量会下降。这不是很模糊,只是一点点,但足以让我烦恼。 – dfox