UIGraphicsGetImageFromCurrentImageContext gives a low quality / low resolution image, how do I get better?

Okay, so I’m taking a snapshot of the photo I took with my camera on the iPhone. I put the camera photo in UIImageView and grab it for a screenshot using this kind of code (this is from http://www.skylarcantu.com/blog/2009/10/16/saving-a-view-as-an-image/ ) ...

 - (void)takeScreenshot {

    UIWindow *theScreen = [[UIApplication sharedApplication].windows objectAtIndex:0];     
    UIGraphicsBeginImageContext(theScreen.frame.size);  
    [[theScreen layer] renderInContext:UIGraphicsGetCurrentContext()];   
    UIImage *screenshot = UIGraphicsGetImageFromCurrentImageContext();    
    UIGraphicsEndImageContext();              
    [self doSomethingWith:screenshot]; 
}

I work the way I want, but the image quality in the screenshot is much worse than the image that I shoot with my camera. Is there any way to overcome this? I think this is because it takes a screenshot that captures the iPhone screen resolution, not the camera resolution - maybe ?!

Any suggestions would be great :-)

+2
1

. (320 x 480) , (1200 x 1600 3G, 1536 x 2048 3GS), UIImageView 320x480, . , - UIImage - - -?

+1

Source: https://habr.com/ru/post/1771922/


All Articles