Argument exception for Image.FromStream
<p>So I have a byte array "sorted" that holds grayscale values and is 14080 bytes long. I'm trying to render this as an image so I thought it would be a good idea to try to convert it to an image object and then use the save function for images to save the image to a path on my computer. However, every time I run it I get an argument exception error. Before I was catching the error it said my parameter was invalid, but I don't understand how that's the case because I'm pretty sure my syntax is right and I filled my "sorted" byte array in the program so I don't get how it could be invalid... Any help would be appreciated- Plus I haven't even gotten to my save method yet because it keeps on breaking so I don't know if this works at all!</p>

<pre><code>try
{
    MemoryStream ms = new MemoryStream(sorted);
    Image returnImage = Image.FromStream(ms);
    returnImage.Save("C:/Users/ttannin/downloads/silouete.jpg");
}
catch (ArgumentException aex)
{
    throw new Exception("Something is broken...", aex);
}
</code></pre>

<p>PS. I was trying to mimic an example found <a href="http://www.codeproject.com/Articles/15460/C-Image-to-Byte-Array-and-Byte-Array-to-Image-Conv" rel="nofollow">here</a>.</p>
