NSData *data = [image compressWithMaxLength:200*1024];
NSLog(@"Before compressing quality, image size ==== = %ld KB",data.length/1024);
UIImage *resultImage = [UIImage imageWithData:data];
NSData *data2 = UIImageJPEGRepresentation(resultImage,1);
NSLog(@"Before compressing quality, image size ====== %ld KB",data2.length/1024);
[_model.images addObject:resultImage];
NSData *data3= UIImageJPEGRepresentation(_model.images[0],1);
NSLog(@"Before compressing quality, image size ====== %ld KB",data3.length/1024);
输出:
2019-05-16 21:48:47.610914+0800 CommunityCloud[7014:1699849] Before compressing quality, image size == 199 KB
2019-05-16 21:48:47.717712+0800 CommunityCloud[7014:1699849] Before compressing quality, image size == 968 KB
2019-05-16 21:48:47.821725+0800 CommunityCloud[7014:1699849] Before compressing quality, image size == 968 KB
无语。。。