IOS string and image transfer

Source: Internet
Author: User

For (UIImage *myimg in _imgarray)

{

NSData *imagedata = uiimagejpegrepresentation (myimg,0.5);

NSString *_encodedimagestr = [ImageData base64encoding];

[Parameters setobject:_encodedimagestr forkey:[nsstring stringwithformat:@ "img[%i]", Imgcount]];

Imgcount + +;

}

Base64 string to UIImage Picture:

NSData *_decodedimagedata = [[NSData alloc] initwithbase64encoding:_encodedimagestr];

UIImage *_decodedimage = [UIImage imagewithdata:_decodedimagedata];

NSLog (@ "===decoded image size:%@", Nsstringfromcgsize (_decodedimage.size));

UIImage picture into Base64 string:

UIImage *_originimage = [UIImage imagenamed:@ "Full_playlist_hl.png"];

NSData *_data = uiimagejpegrepresentation (_image, 1.0f);

NSString *_encodedimagestr = [_data base64encoding];

NSLog (@ "===encoded image:\n%@", _encodedimagestr);

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.