I'm trying to convert a data:image/png;base64 to an UIImage, then get a CGImage and from the UIImage and send it to a Zebra printer.
I try this code:
NSData *datad = [[NSData alloc] initWithData:[NSData dataFromBase64String:@"data:image/png;base64,iVBORw0KGgoAAAANS...etc"]];
UIImage *image = [UIImage imageWithData:datad];
[image CGIamge]
And i'm trying with this code:
NSString *base64Url = @"data:image/png;base64,iVBORw0KGgoAAAANS...etc";
NSURL *url = [NSURL URLWithString:base64Url];
NSString *base64Image = [NSString stringWithContentsOfURL:url];
url = [NSURL URLWithString:base64Image];
NSData *rawImageData = [NSData dataWithContentsOfURL:url];
UIImage *image = [UIImage imageWithData:rawImageData];
With the second part of the code i get a black image.
I'm doing something wrong for sure.
I'm also try to do this How to create CGImageRef from NSData string data (NOT UIImage)
aaaaand nothing.
Please, if someone could help me, you will be my heroe!