title: What method for detecting image type is more reliable: content-type or MIME-sniffing?
body: <p>I want to detect the image file format in a Windows application. Images are either downloaded from the web (via HTTP) or loaded from local files.</p>
  
  <p>Which method is more reliable for detecting the image file format for the files, downloaded from the Web?</p>
  
  <ul>
  <li>File extension is the most obvious way, but it is often not correct or is missing</li>
  <li>HTTP header content-type is a good candidate (I can check image type without downloading it via HTTP HEAD command), but sometimes it is not set properly</li>
  <li>MIME-sniffing (via Windows API FindMimeFromData command or by manually checking file content for known signatures) is the last method I am aware of, but I've never used it and I am not sure if it is reliable</li>
  </ul>
  
  <p>So, what should I use?</p>