如何通过套接字发送BitmapImage? [英] How to send BitmapImage over socket?

查看:95
本文介绍了如何通过套接字发送BitmapImage?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用Raspberry Pi 2创建一个简单的Web服务器。目前我可以通过StreamSocket发送文本和HTML代码。我的问题是我无法弄清楚如何通过StreamSocket发送BitmapImage,以便它可以在浏览器中显示
。任何人都可以提出任何建议吗?

I am trying to make a simple web server with the Raspberry Pi 2. At the moment I can get it to send text and HTML code over the StreamSocket. My problem is that I can't figure out how to send a BitmapImage over the StreamSocket so that it can be displayed in the browser. Can any one offer any suggestions?

推荐答案

我实际上并没有尝试这个,但也许你可以使用JpegBitmapEncoder并将你的图像附加到那个(Frames.Add)。从那里你可以调用编码器的Save函数并将StreamSocket的OutputStream作为目标流传递。
I didn't actually try this but perhaps you could use JpegBitmapEncoder and attach your image to that (Frames.Add). From there you could call the encoder's Save function and pass the StreamSocket's OutputStream as the target stream.


这篇关于如何通过套接字发送BitmapImage?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆