title: Checking an image file size in bytes
body: <p>The image size is about 2.5MB</p>
  
  <p>This code gives me the right size:</p>
  
  <pre><code>var fileLength = new FileInfo(path).Length;
  </code></pre>
  
  <p>This code gives me about 600KB</p>
  
  <pre><code>Image image= Image.FromFile(path);
  byte[] imageByte = imageToByteArray(image);
  long legnth= imageByte.Length;
  
  public static byte[] imageToByteArray(System.Drawing.Image imageIn)
  {
      MemoryStream ms = new MemoryStream();
      imageIn.Save(ms, System.Drawing.Imaging.ImageFormat.Png);
      return ms.ToArray();
  }
  </code></pre>
  
  <p>What am i missing?</p>
  
  <p>The problem is that i recive the image in byte[] so..</p>