convert image to base64

UIImage *img = [UIImage imageNamed:@"mapping.png"];
NSData *data = UIImagePNGRepresentation(img);
NSString * _base64=[[NSString alloc]init];

_base64=[data base64EncodedStringWithOptions:NSDataBase64Encoding64CharacterLineLength];
Previous
Next Post »

1 comments:

Write comments
Unknown
AUTHOR
4 May 2017 at 05:00 delete

base64 to image:

NSData *data1 = [[NSData alloc] initWithBase64EncodedString:_base64 options:NSDataBase64DecodingIgnoreUnknownCharacters];

//initiate image from data

UIImage *captcha_image = [[UIImage alloc] initWithData:data1];

NSLog(@"%@",captcha_image);

Reply
avatar