Search code examples
iphonecgimagephotos

Storing CGImage in Photos app?(iPhone)


lets say I have a CGImage and want to store it in the Photos app that comes standard with every iPod Touch/iPhone how would I do this?


Solution

  • First convert the CGImage to a UIImage:

    UIImage *_myImage = [UIImage imageWithCGImage:cgImage];
    

    And then use the UIImageWriteToSavedPhotosAlbum() function:

    UIImageWriteToSavedPhotosAlbum(UIImage *image, id completionTarget, SEL completionSelector, void *contextInfo);
    

    to write the UIImage to the Photo Album.