I need to convert byte array into Image type. My byte array contains raw image and the image is valid. I have tried all solution from net but still getting the error:
Parameter is not valid.
Following is my code:
byte[] arr = File.ReadAllBytes(@"C:\Users\aa\Desktop\Image.raw");
MemoryStream ms = new MemoryStream(arr,0,arr.Length);
ms.Seek(0, SeekOrigin.Begin);
Image img = Image.FromStream(ms);
ms.Dispose();
I have also tried with:
using(MemoryStream ms = new MemoryStream(arr,0,arr.Length))
{
//my code
}