字节数组到图像格式 [英] Byte array to image format
本文介绍了字节数组到图像格式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
你好,
谁能告诉我如何将字节数组转换为图像格式.....我已经将字节数组存储到数据库..现在我想要检索那个图像
谢谢
hello,
Can anyone tell me how to convert Byte array to image format.....i have stored image in byte array to database..now i want to retrieve that image
Thank you
推荐答案
请看这里:为什么我得到参数无效。我从数据库中读取图像时出现异常? [ ^ ] - 它解释了获取图像的方法,并解释了如何存储它,以防万一你可能有错! ;笑:
See here: Why do I get a "Parameter is not valid." exception when I read an image from my database?[^] - it explains teh way to get the image, and explains how to store it, just in case you might have got that wrong! ;laugh:
您好,
您可以通过此函数将图像从bytearray转换为其原始形式
Hello ,
You can convert the image from bytearray to its original form by this function
public Image GetDataToImage(byte[] pData)
{
try
{
ImageConverter imgConverter = new ImageConverter();
return imgConverter.ConvertFrom(pData) as Image;
}
catch (Exception ex)
{
return null;
}
}
现在传递函数中的byte []数组,该数组存储在数据库中,你将得到Image 。
谢谢
Now pass the byte[] array in the function , which is stored in Database and you will get Image .
Thanks
这篇关于字节数组到图像格式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文