C# 尝试检索图像时,Windows7中的参数无效
检索图像时出现参数无效异常(错误仅在Win7上发生,但在XP操作系统中工作正常) 这是我的密码C# 尝试检索图像时,Windows7中的参数无效,c#,image,windows-7,stream,C#,Image,Windows 7,Stream,检索图像时出现参数无效异常(错误仅在Win7上发生,但在XP操作系统中工作正常) 这是我的密码 Image _image = null; ImageConverter imgConverter = null; _image = imgConverter.ConvertFrom(pItem.FrontImage) as System.Drawing.Image; //pItem.FrontImage is Byte[] 我试着用 MemoryStream ms = new MemoryStrea
Image _image = null;
ImageConverter imgConverter = null;
_image = imgConverter.ConvertFrom(pItem.FrontImage) as System.Drawing.Image; //pItem.FrontImage is Byte[]
我试着用
MemoryStream ms = new MemoryStream(pItem.FrontImage);
ms.Write(pItem.FrontImage, 0, pItem.FrontImage.Length);
_image = Image.FromStream((Stream)ms);
但是没有用
你能帮帮我吗
完全错误:
System.ArgumentException:参数无效。在System.Drawing.Image.FromStream(Stream Stream,Boolean useEmbeddedColorManagement,Boolean validateImageData)中
在System.Drawing.Image.FromStream(Stream)中
如果没有,是否有其他方法可以在不使用FromStream的情况下从字节[]转换图像。我已尝试使用File.writealBytes将字节[]保存为Jpg,但没有任何用处(图像显示为已损坏).发布确切的异常。您的代码将无法编译。此外,我们需要知道pItem是什么?
ArgumentException
具有保存参数名称的属性。