Save Image to sandbox from UIImage in iPhone?

I guess there is a touch of complication in that you probably want to write into the Library/Caches directory, so when the phone gets backed up you don't save those files. Get the root of the app folder w/ NSHomeDirectory() and then append Library/Caches. You can write an NSData to the fs w/ a method on NSData.

If you have a UIImage, you can do UIImageJPEGRepresentation() or UIImagePNGRepresentation to get data.

4 You probably want to use NSArray *paths = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES); NSString *cachesDirectory = paths objectAtIndex:0; Rather than appending 'Library/Caches' yourself. – Jesse Rusak Mar 31 '10 at 12:05.

NSData *imgData = UIImageJPEGRepresentation(image, 1); CGImageSourceRef source = CGImageSourceCreateWithData((CFMutableDataRef)imgData, NULL); NSDictionary *metadata = (NSDictionary *) CGImageSourceCopyPropertiesAtIndex(source,0,NULL)autorelease; NSString *jpgPath = NSHomeDirectory() stringByAppendingPathComponent:@"Documents/Test. Jpg"; imageMutableData writeToFile:jpgPath atomically:YES; It will copy your image to documents folder in sandbox with name Test.jpg. If you want to do it for PNG you can try UIImagePNGRepresentation(image).

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions