iphone, when saving image with “renderInContext” to device, the image is blurry?

梦想的初衷 提交于 2019-12-23 07:56:10

问题


I'm using this code to render an image from view. Then i am saving it to photo album. The image is blurry? Why? Is there a solution?

UIGraphicsBeginImageContext(self.view.bounds.size);
[self.view.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage *viewImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();

Tnx all.


回答1:


You are propably using a retina device, Change the following

UIGraphicsBeginImageContext(self.view.bounds.size)

to

UIGraphicsBeginImageContextWithOptions(self.view.bounds.size, self.view.opaque, 0.0);


来源:https://stackoverflow.com/questions/11202628/iphone-when-saving-image-with-renderincontext-to-device-the-image-is-blurry

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!