File Base64 will laterdoubled the rise, for example, a 52kb picture base64 after the string file size is 185kb, in a string back to the picture for 135kb picture to text:
UIImage *_originimage = [UIImage imagenamed:@ "0.jpg"1.0f); *_encodedimagestr = [_data base64encodedstringwithoptions:nsdatabase64encoding64characterlinelength];[ _encodedimagestr writetofile:@ "/users/singer/documents/0.txt" atomically: YES encoding:nsutf8stringencoding Error:nil]; NSLog (@ "===encoded image:\n%@", _ENCODEDIMAGESTR);
Text to Picture:
NSString *imagestr = [NSString stringwithcontentsoffile:@"/users/singer/documents/0.txt"encoding:nsutf8stringencoding Error:nil]; NSData*d =[[NSData alloc]initwithbase64encodedstring:imagestr options:nsdatabase64decodingignoreunknowncharacters]; UIImage*image =[UIImage imagewithdata:d]; Uiimageview*imageview = [[Uiimageview alloc]initwithframe:cgrectmake ( -, -, $, $)];imageview.image=image; [Self.view Addsubview:imageview]; [D WriteToFile:@"/users/singer/documents/1111.jpg"Atomically:yes];
Base64 to transcode pictures and files into strings (inter-transfer)