A
Arno
Hi,
I want to convert a byte[] to a Image. I read in a newsgroup that the
best way is to use a MemoryStream. I tried it, but I get always a
Exception while creating the Image(An unhandled exception of type
'System.ArgumentException' occurred in system.drawing.dll. Additional
information: Ungültiger Parameter verwendet). Here is my code:
Image newImage;
using (MemoryStream ms = new MemoryStream(length))
{
byte[] bArray = new byte[length];
for(int k=0; k<length; k++)
{
bArray[k] = 10;
}
ms.Write(bArray,0,length);
newImage = Image.FromStream(ms);
}
}
Thanks for your help !
Arno
I want to convert a byte[] to a Image. I read in a newsgroup that the
best way is to use a MemoryStream. I tried it, but I get always a
Exception while creating the Image(An unhandled exception of type
'System.ArgumentException' occurred in system.drawing.dll. Additional
information: Ungültiger Parameter verwendet). Here is my code:
Image newImage;
using (MemoryStream ms = new MemoryStream(length))
{
byte[] bArray = new byte[length];
for(int k=0; k<length; k++)
{
bArray[k] = 10;
}
ms.Write(bArray,0,length);
newImage = Image.FromStream(ms);
}
}
Thanks for your help !
Arno