- 将图片转化为二进制流,并写入文件
// PNG
NSData *data = UIImagePNGRepresentation(newImage);
//JPEG
// compressionQuality: 转换为NSData类型压缩比例(0~1)
// NSData *data2 = UIImageJPEGRepresentation(<#UIImage * _Nonnull image#>, <#CGFloat compressionQuality#>);
[data writeToFile:@"/Users/gaoxinqiang/Desktop/newImage.png" atomically:YES];
网友评论