title: Parameter is not valid , while converting byte array to image
body: <p>I want to save images in access database , I used OLE object .</p>
  
  <p>The idea is to convert the image into bytes array , then adding the bytes array in the database. </p>
  
  <p>this is the function : </p>
  
  <pre><code>    public static byte[] ImageToByte(Image img)
      {
          ImageConverter converter = new ImageConverter();
          return (byte[])converter.ConvertTo(img, typeof(byte[]));
      }
  </code></pre>
  
  <p>this works fine .</p>
  
  <p>When I want to return the bytes array to the image i get an exception :</p>
  
  <p>argument exception was unhandled
  Parameter is not valid.</p>
  
  <p>I tried two functions to convert the bytes array to the image :</p>
  
  <pre><code>    public static Image ImageFromByte(byte[] image)
      {
          ImageConverter ic = new ImageConverter();
          Image img = (Image)ic.ConvertFrom(image);//here the exception comes
          return img;
      }
  </code></pre>
  
  <p>OR:</p>
  
  <pre><code>    public static Image ImageFromByte1(byte[] byteArrayIn)
      {
          MemoryStream ms = new MemoryStream(byteArrayIn);
          Image returnImage = Image.FromStream(ms);//here the exception comes
          return returnImage;
      }
  </code></pre>
  
  <p>What is the problem , how to fix it ?</p>