i could see this question is asked many many times but none seems to be straight forward answer. so am posting this question.
I am reading BLOB from oracle database into photoByteArray[] array. Now i just want to save this byte[] into file systems as anyFileName.jpeg (or any format), but i get the "Parameter not vaid" exception.
What i tried is
using (var ms = new System.IO.MemoryStream(photoByteArray))
{
using (var img = Image.FromStream(ms)) // error thrown here as 'parameter is not valid'
{
img.Save("D:\\anyFileName.jpg", ImageFormat.Jpeg);
}
}
My bytes
Few are suggesting that some header gets added in the byte array, but how and howmuch to remove that kind of header is not straight forward way.
What am i doing wrong ?