title: Fix images for which the mime type can not be detected
body: <p>I have a <em>lot</em> of images that I need to process using a third party PHP tool. All these images are GIFs, JPEGs or PNGs. However, on some of the images I get an error because of an incorrect mime type. Turns out that some images (mostly JPG files) are detected as "application/octet-stream".</p>
  
  <p>Whenever I open the image an any viewer, all seems ok. After resaving such an image using Photoshop, the mime type is detected correctly as "image/jpeg". I'm just not exited about opening and resaving thousands of images.</p>
  
  <p>I've constructed a list of filenames for which the problem occurs. Is there any way to 'fix' the image such that the correct mime type is detected?</p>
  
  <p>I've found the incorrect mime types using the following command:
  <code>file --mime-type &lt;filename&gt;</code></p>
  
  <p><strong>Here are some example images:</strong></p>
  
  <ul>
  <li><a href="https://drive.google.com/file/d/0By_lc6RkVy-1ZEIzZ0hTZDZBdEE/view?usp=sharing" rel="nofollow">Example of problem 1</a></li>
  <li><a href="https://drive.google.com/file/d/0By_lc6RkVy-1VWptZFdlNVllRms/view?usp=sharing" rel="nofollow">Example of problem 2</a></li>
  <li><a href="https://drive.google.com/file/d/0By_lc6RkVy-1d0FWWkhmenE4SVk/view?usp=sharing" rel="nofollow">Example of an image that has no problem</a></li>
  </ul>
  
  <p>Running <code>identify -ping -verbose &lt;filename&gt;</code> doesn't return a mime type only a <em>Format</em>. The format is <code>Format: JPEG (Joint Photographic Experts Group JFIF format)</code> for all JPG images with or without correct mime.</p>
  
  <p><strong>Some more info about versions:</strong></p>
  
  <pre><code>$ file --version
  file-5.14
  magic file from /etc/magic:/usr/share/misc/magic
  
  $ identify --version
  Version: ImageMagick 6.7.7-10 2014-03-06 Q16 http://www.imagemagick.org
  Copyright: Copyright (C) 1999-2012 ImageMagick Studio LLC
  Features: OpenMP
  </code></pre>