Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

like image 598
Shay Avatar asked Jun 26 '12 07:06

Shay


1 Answers

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);
like image 77
Omar Abdelhafith Avatar answered Oct 07 '22 01:10

Omar Abdelhafith