开发者

UIGraphicsGetImageFromCurrentImageContext() Retina resolution?

开发者 https://www.devze.com 2023-02-10 08:21 出处:网络
I\'m taking a picture of my screen and manipulating it by using UIGraphicsGetImageFromCurrentImageContext().Everything is working just fine.However, on an iPhone 4, the resolution looks pretty shabby

I'm taking a picture of my screen and manipulating it by using UIGraphicsGetImageFromCurrentImageContext(). Everything is working just fine. However, on an iPhone 4, the resolution looks pretty shabby as it seems like the image it uses is standard resolution, not @2x. Is there any way to increase the resolution of the resulting image?

UIGraphicsBeginImageContext(self.view.bounds.size);
[self.view.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage *image = UIGraphicsGetImageFromCurr开发者_C百科entImageContext();
UIGraphicsEndImageContext();


You should use UIGraphicsBeginImageContextWithOptions which allows you to set the scale factor. Use a scale factor of 0.0f to use the device's scale factor.

0

精彩评论

暂无评论...
验证码 换一张
取 消