Parameter is not valid when getting image from stream
- by duka1
Hi guys,
I have this code:
MemoryStream ms = new MemoryStream(newbytes, 0,
newbytes.Length);
ms.Position = 0;
ms.Write(newbytes, 0, newbytes.Length);
Image img = Image.FromStream(ms);
img.Save(@"C:\Users\gsira\Pictures\Blue hills5.jpg");
I get this error at the Image.FromStream(ms) call:
System.ArgumentException: Parameter is not valid.
at System.Drawing.Image.FromStream(Stream stream, Boolean useEmbeddedColorManagement, Boolean validateIma
How can I resolve this? A couple of links which solve this problem (one on an MSDN thread) are broken so I am lost.