我想将图片发布到以下格式的网络服务:
图片=%89PNG%0D%0A%1A%0A%00%00%00%0DIHDR%00%00%00%01%00%00%00%01%01%03%00%00%00% 25%DBV%CA%00%00%00%04gAMA%00%00%B1%8F%0B%FCA%05%00%00%00%01sRGB%00%AE%CE%1C%E9%00%00% 00 + CHRM%00%00Z%26%00%00%80%84%00%00%FA%00%00%00%80%E8%00%00u0%00%00%EA%60%00%00% 3A%98%00%00%17P%9C%BAQ%3C%00%00%00%06PLTE%11%0B%0C%FF%FF%FFPU%C0J%00%00%00%01tRNS%94%B7% 84%8F%3B%00%00%00%01bKGD%01%FF%02-%DE%00%00%00%09pHYs%00%00%00H%00%00%00H%00F%C9k%3E%00 %00%00%0AIDAT%08%D7C%60%00%00%00%02%00%01%E2%21%BC3%00%00%00%25tEXtdate%3Acreate%002013-01-06T12%3A31 3A53% %2B02%3A00%92R%3A%D3%00%00%00%25tEXtdate%3Amodify%002013-01-06T12%3A31 3A53%2B02%%%3A00 E3%0F%82o%00%00%00%19tEXtSoftware%00Adobe + ImageReadyq%C9e%3C%00%00%00%00IEND%AEB%60%82
我的问题是如何将图像转换为此格式。
感谢您的帮助。
答案 0 :(得分:1)
我找到了解决方案。如果有人需要它:
NSData *imageData = UIImagePNGRepresentation(self.photoImageView.image);
NSString *imageStringASCII = [[NSString alloc] initWithData:imageData encoding:NSASCIIStringEncoding];
答案 1 :(得分:0)
将您的图片转换为Base64,即使用以下Base64
库进行编码并将图片上传到服务器。在服务器解码并转换为图像和存储