Iphone – How to save a png image to camera roll

iphoneuiimage

I'd like to save screenshots from my game to camera roll.
Right now I'm using UIImageWriteToSavedPhotosAlbum which saves the image in jpg format with way too much ugly jpg artifacts.
Is there a way to save an UIImage in png format to camera roll?

Best Answer

First you have to add AssetsLibrary Framework, than like this:

ALAssetsLibrary *library = [[ALAssetsLibrary alloc] init];

UIImage *image = ... some image

[library writeImageDataToSavedPhotosAlbum: UIImagePNGRepresentation(image) metadata:nil completionBlock:nil];
Related Topic