iPhone UIImage保存到文件
2010-08-24 22:29
453 查看
/ Create paths to output images NSString *pngPath = [NSHomeDirectory() stringByAppendingPathComponent:@"Documents/Test.png"]; NSString *jpgPath = [NSHomeDirectory() stringByAppendingPathComponent:@"Documents/Test.jpg"]; // Write a UIImage to JPEG with minimum compression (best quality) // The value 'image' must be a UIImage object // The value '1.0' represents image compression quality as value from 0.0 to 1.0 [UIImageJPEGRepresentation(image, 1.0) writeToFile:jpgPath atomically:YES]; // Write image to PNG [UIImagePNGRepresentation(image) writeToFile:pngPath atomically:YES]; // Let's check to see if files were successfully written... // Create file manager NSError *error; NSFileManager *fileMgr = [NSFileManager defaultManager]; // Point to Document directory NSString *documentsDirectory = [NSHomeDirectory() stringByAppendingPathComponent:@"Documents"]; // Write out the contents of home directory to console NSLog(@"Documents directory: %@", [fileMgr contentsOfDirectoryAtPath:documentsDirectory error:&error]);
相关文章推荐
- iPhone UIImage保存到文件,PNG/JPEG自适应
- iPhone UIImage保存到文件,PNG/JPEG自适应
- iPhone UIImage保存到文件,PNG/JPEG自适应
- iphone 怎样将UIImage对象保存到JPG或者PNG文件中?
- iPhone UIImage保存到文件,PNG/JPEG自适应
- iphone UIImageWriteToSavedPhotosAlbum 保存图片
- iphone UIImageWriteToSavedPhotosAlbum 保存图片
- iphone 文件保存策略
- iphone Documents文件中保存的图片如何读取并显示?
- iphone 属性列表把数据保存到文件中
- 怎样将UIImage对象保存到JPG或者PNG文件中?
- 保存图片到相册 iphone UIImageWriteToSavedPhotosAlbum 保存图片
- iphone 文件保存策略
- iphone 从网络上获取图片并保存 详解iPhone应用开发中缓存文件
- 将UIImage对象保存到JPG或者PNG文件中
- 保存UIImage到文件--到本地自己的程序目录
- 怎样将UIImage对象保存到JPG或者PNG文件中?
- iphone UIImageWriteToSavedPhotosAlbum 保存图片
- iphone UIImageWriteToSavedPhotosAlbum 保存图片
- iphone 文件保存策略