Posted By

mracoker on 02/10/10


Tagged

image save


Versions (?)

Who likes this?

2 people have marked this snippet as a favorite

umang_nine
cnathan


Save Image Example


 / Published in: Objective C
 

URL: http://www.iphonedevsdk.com/forum/iphone-sdk-development/10006-uiimagepickercontroller-saving-cropped-image.html

  1. NSString *documentsPath = [NSHomeDirectory() stringByAppendingPathComponent: @"Documents"];
  2.  
  3. NSString *filePath = [documentsPath stringByAppendingPathComponent: @"selectedImage.png"];
  4.  
  5. int i = 0;
  6.  
  7. while ( [[NSFileManager defaultManager] fileExistsAtPath: filePath] )
  8. {
  9. filePath = [NSString stringWithFormat: @"%@/%@-%d.@%@", documentsPath, @"selectedImage", ++i, @"png"];
  10. }
  11.  
  12. [NSImagePNGRepresentation(image) writeToFile: filePath atomically: YES]

Report this snippet  

You need to login to post a comment.