title: Creating and save an image from a byte[] causes Parameter is not valid exception
body: <p>I have implemented the following functionality that connects to webservice and downloads a favicon from a given site and saves it to a byte[] which I store in our database. I now want to set it up so that it saves the icon to the disk. However I am getting a "Parameter is not valid" when I try and create the image from the byte[].</p>
  
  <p>My code is as follows.. </p>
  
  <pre><code>stream.Write(imageByteArray, 0, imageByteArray.Length);
  Image i = Image.FromStream(stream); // EXCEPTION HAPPENS HERE.
  i.Save(@"C:\tmp\" + filename + ".ico");
  </code></pre>
  
  <p>The exception occurs on the middle line. </p>
  
  <p>This code works perfectly 9 times out of ten, but for some favicons, even thought the icon is a valid image (or at least it appears to be and it shows in the browser when point at it)  I get this exception. </p>
  
  <p>Does anyone have any ideas? I am pulling my hair out here! </p>
  
  <p>Thanks </p>
  
  <p>Dave </p>
  
  <p>Edit: The value in the array that appears to throw the error is 127.</p>