UIImage Saving image with file name on the iPhone

erastusnjuki picture erastusnjuki · Feb 15, 2010 · Viewed 23.8k times · Source

How can I save an image (like using UIImageWriteToSavedPhotosAlbum() method) with a filename of my choice to the private/var folder?

Answer

erastusnjuki picture erastusnjuki · Feb 16, 2010

Kenny, you had the answer! For illustration I always think code is more helpful.

//I do this in the didFinishPickingImage:(UIImage *)img method

NSData* imageData = UIImageJPEGRepresentation(img, 1.0);


//save to the default 100Apple(Camera Roll) folder.   

[imageData writeToFile:@"/private/var/mobile/Media/DCIM/100APPLE/customImageFilename.jpg" atomically:NO];