本文介绍了错误"参数无效"同时转换成字节的图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我转换成字节的图像,但我得到一个错误
I am converting bytes into an image but I get an error
参数是无效的。
我贴我的code。请检查code和建议,这是我做的对还是错。
I am pasting my code. Kindly check the code and suggested that was I am doing right or wrong.
Image arr1 = byteArrayToImage(Bytess);
这是该功能。
public static Image byteArrayToImage(byte[] byteArrayIn)
{
if (null == byteArrayIn || byteArrayIn.Length == 0)
return null;
MemoryStream ms = new MemoryStream(byteArrayIn);
try
{
Process currentProcess1 = Process.GetCurrentProcess();
Image returnImage = Image.FromStream(ms);
return returnImage;
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
我应用了许多技术和解决方案,但它并没有为我工作。
I applied many techniques and solutions but it did not work for me
您的答案是AP preciated。
Your answer would be appreciated.
感谢
推荐答案
试试这个
public Image byteArrayToImage(byte[] byteArrayIn)
{
System.Drawing.ImageConverter converter = new System.Drawing.ImageConverter();
Image img = (Image)converter.ConvertFrom(byteArrayIn);
return img;
}
这篇关于错误"参数无效"同时转换成字节的图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!