UIImage

2016-11-07  本文已影响17人  不愿将就_Once

将 UIImage 转换为 CIImage

CIImage  *ciImage = [UIImage imageNamed:@"test.png"].CIImage;

将 CIImage 转换为 UIImage

UIImage * image = [UIImage imageWithCIImage:ciimage];

图片转成 Base 64 编码

//UIImage图片转成Base64字符串:
UIImage *originImage = [UIImage imageNamed:@"originImage.png"];
NSData *data = UIImageJPEGRepresentation(originImage, 1.0f);
NSString *encodedImageStr = [data base64EncodedStringWithOptions:NSDataBase64Encoding64CharacterLineLength];
//Base64字符串转UIImage图片:
NSData *decodedImageData = [[NSData alloc] 
initWithBase64EncodedString:encodedImageStr options:NSDataBase64DecodingIgnoreUnknownCharacters];
UIImage *decodedImage = [UIImage imageWithData:decodedImageData];
上一篇下一篇

猜你喜欢

热点阅读