图片转base64串:
UIImage *_originImage = [UIImage imageNamed:@"full_playlist_hl.png"];
NSData *_data = UIImageJPEGRepresentation(_image, 1.0f);
NSString *_encodedImageStr = [_data base64Encoding];
NSLog(@"===Encoded image:\n%@", _encodedImageStr);
Base64串转图片:
NSData *_decodedImageData = [[NSData alloc] initWithBase64Encoding:_encodedImageStr];
UIImage *_decodedImage = [UIImage imageWithData:_decodedImageData];
NSLog(@"===Decoded image size: %@", NSStringFromCGSize(_decodedImage.size));

本文详细介绍了如何将图片转换为Base64编码字符串及反向操作,包括关键技术实现和代码示例。
682

被折叠的 条评论
为什么被折叠?



