开发者

How do I encode an image to be sent as a message? [duplicate]

开发者 https://www.devze.com 2023-03-22 16:55 出处:网络
This question already has an answer here: UIImagePNGRepresentation slow or am I doing something wrong?
This question already has an answer here: UIImagePNGRepresentation slow or am I doing something wrong? (1 answer) Closed 2 years ago.

I can't figure out how to encode and decode a UIImage to send as a message. I have successfully encoded C datatypes, strings, and objects with basic types by implementing the NSCoding protocol for an Object. I have even sent them over a bluetooth connection and decoded and used them successfully.

I can't find any documentation nor Internet examples showing how to send an Image over the wire.

To use my connection, I need to convert the Ima开发者_运维知识库ge to NSData; however, I can't find an API to do that for me. UIImage does not implement encodeWithCoder.

Does anyone have an example that can guide me?


You should be able to just convert an image to bytes, just as the SQL data type stores an image using the image SQL data type. I know very little about the iphone-sdk-4.0, but this should get you on the right track.

0

精彩评论

暂无评论...
验证码 换一张
取 消