来自UIGraphicsGetImageFromCurrentImageContext()的更高质量的图像 [英] Better quality image from UIGraphicsGetImageFromCurrentImageContext()
本文介绍了来自UIGraphicsGetImageFromCurrentImageContext()的更高质量的图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我目前正在使用 UIGraphicsGetImageFromCurrentImageContext()将内容的图像保存到用户的相机胶卷,但图像质量比在模拟器中进行屏幕截图时差。有没有办法改善它?无论如何,保存的图像的格式是什么? BMP?有没有办法改变这个?
I'm currently using UIGraphicsGetImageFromCurrentImageContext() to save a content's image to a user's camera roll, but the image quality is worse than if I do a screen shot in the simulator. Is there any way to improve it? And what format the saved image is in anyway? Bmp? Is there any way to change this?
这是我的保存代码:
CGSize size = [content bounds].size;
UIGraphicsBeginImageContext(size);
[[content layer] renderInContext:UIGraphicsGetCurrentContext()];
UIImage *originalImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
UIImageWriteToSavedPhotosAlbum(originalImage, self, @selector(image:didFinishSavingWithError:contextInfo:), nil);
推荐答案
而不是使用 UIGraphicsBeginImageContext
你应该使用:
Instead of using UIGraphicsBeginImageContext
you should be using:
UIGraphicsBeginImageContextWithOptions(size, NO, 0);
这篇关于来自UIGraphicsGetImageFromCurrentImageContext()的更高质量的图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文