如何在asp.net中将字节数组转换为Image [英] How do I convert byte array to Image in asp .net

查看:117
本文介绍了如何在asp.net中将字节数组转换为Image的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨亲爱的所有人....





我有一个字节数组,其中包含一些代表图像的数据。(个人资料照片) 。

我想从这个字节数组中显示原始图像。任何人都可以告诉我这里应该使用哪个控件以及如何将这个字节数组转换为图像以及如何在aspx页面上显示这个图像..







谢谢大家.....

Hi Dear All....


I have a byte array containing some data representing an image.(Profile Photo).
I would like to display the original image from this byte array. Could any one please tell me which control should I use here and how to convert this byte array to image and how to display this image on the aspx page..



Thank You All.....

推荐答案

转换很简单:

Converting is simple:
using (MemoryStream stream = new MemoryStream(bytes))
{
    myImage = new Bitmap(stream);
}



然后只需将控件的Image属性设置为myImage。


Then just set the Image property of your control to myImage.


这篇关于如何在asp.net中将字节数组转换为Image的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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