开发者

Sending a bitmap from an Android to a laptop

A friend at work has gone on holiday and left me with an app that sends a Bitmap (as a byte array using Bitmap.CompressFormat) from an android device to a laptop running an application that has to be written in开发者_如何学JAVA C sharp.

Is there any way I'm going to be able to end up with the picture sent, saved on the laptop? Or am I changing his app for him?

Sorry, quick edit.

Is there going to be any conflict in between the java and c sharp framework here? My worry is that a bitmap class in java differs from that off a c sharp bitmap class.


I think bitmap in byte is always a bitmap (but I could be wrong, if java serialize it's bitmap class instead of the image this thing it's not true). However, if you have a byte array you can start by trying to use the c# constructor http://msdn.microsoft.com/it-it/library/z7ha67kw.aspx Bitmap(Stream), with a memory stream over the byte array

Hope this helps a bit


Try to answer this questions:

It seem that you are creating a compressed bitmap (= jpeg or png) and sending this as a stream of bytes to your laptop?

Are you able to receive this stream of bytes?

If you save this stream of bytes to file and set the proper extension (jpg or png), does it open as a normal image file that can be viewed?

If above answers are all yes, than you should have no problems: c# can open images as Bitmaps. Just use appropriate constructor.


If you were sending a raw bitmap with multibyte data (i.e. more than 256 colors) between devices you'd have to worry about byte order (big-endian vs. little-endian architectures). Your post seems to imply that you're sending a PNG or JPEG, and those formats specify a byte ordering, so you should be fine.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜