title: Getting image dimensions without reading the entire file
body: <p>Is there a cheap way to get the dimensions of an image (jpg, png, ...)? Preferably, I would like to achieve this using only the standard class library (because of hosting restrictions). I know that it should be relatively easy to read the image header and parse it myself, but it seems that something like this should be already there. Also, I’ve verified that the following piece of code reads the entire image (which I don’t want):</p>
  
  <pre><code>using System;
  using System.Drawing;
  
  namespace Test
  {
      class Program
      {
          static void Main(string[] args)
          {
              Image img = new Bitmap("test.png");
              System.Console.WriteLine(img.Width + " x " + img.Height);
          }
      }
  }
  </code></pre>