Skip to content

Instantly share code, notes, and snippets.

@dm-z
Created May 12, 2014 10:38
Show Gist options
  • Save dm-z/835152b06bac17ecfeaa to your computer and use it in GitHub Desktop.
Save dm-z/835152b06bac17ecfeaa to your computer and use it in GitHub Desktop.
Save UIImage to disk
- (void)saveTestImage:(UIImage *)image
{
NSArray * paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString * basePath = ([paths count] > 0) ? [paths objectAtIndex:0] : nil;
NSData * binaryImageData = UIImagePNGRepresentation(image);
[binaryImageData writeToFile:[basePath stringByAppendingPathComponent:@"TestImage.png"] atomically:YES];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment