使用Objective C将位图转换为PNG或JPG

时间:2020-12-21 21:16:32

Anyone knows how to convert a bitmap to PNG or JPG using Objective C assuming I have

任何人都知道如何使用Objective - C将位图转换为PNG或JPG

CGImageRef imageRef;

CGImageRef imageRef;

1 个解决方案

#1


7  

UIImage *myImage = [UIImage imageWithCGImage:imageRef];
NSData *pngData = UIImagePNGRepresentation(myImage);
NSData *jpgData = UIImageJPEGRepresentation(myImage);

#1


7  

UIImage *myImage = [UIImage imageWithCGImage:imageRef];
NSData *pngData = UIImagePNGRepresentation(myImage);
NSData *jpgData = UIImageJPEGRepresentation(myImage);