user339946
user339946

Reputation: 6119

How to take high quality screenshot / save image?

I'm currently using the following code to produce an image whenever the user presses "Save Image":

    self.toolbar.hidden = YES;

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

    self.toolbar.hidden = NO;

I'm basically hiding the elements on the screen that I don't want to show, then taking a normal screenshot and saving to the photo library. I was wondering if it was possible to save at a higher resolution or quality. Thank you

Upvotes: 0

Views: 6371

Answers (1)

antf
antf

Reputation: 3212

When you take a screen shot you take it with the resolution of the screen itself and not with the resolution of the items. Put differently if you have a 10 Mega Pixel image that you zoomed out to fit the screen you are no more seeing it as 10 MP, you are seeing it as screen resolution. In retina display (assuming iPhone) the screen resolution is 640*960 pixels and in normal displays it is 320*480, so every time you take a screenshot you will have this resolution not more.

Upvotes: 2

Related Questions