title: Unable to load JPEG-image with BitmapFactory.decodeFile. Returns null
body: <p>I'm making an app that show a lot of images that are generated from PDF-files by Imagemagick. Some of the images, can't be loaded with BitmapFactory. It simply returns null istead of a bitmap. </p>
  
  <p>The log says:</p>
  
  <pre><code>    D/skia(15101): --- decoder-&gt;decode returned false
  </code></pre>
  
  <p>It isn't a memory problem as some of the images with the problem is very small, and the images aren't corrupt because I can show them on any other machine. Additionally BitmapFactory is able to decode the width and height if I use</p>
  
  <pre><code>    inJustDecodeBounds = true;
  </code></pre>
  
  <p>in the options.</p>
  
  <p>I've tried to load one of the images with an external Image Viewer (<a href="https://play.google.com/store/apps/details?id=com.alensw.PicFolder" rel="nofollow">QuickPic</a>) without luck. It also returns "Load failed", which indicates that SKIA believes the image is corrupt or at least not supported for some reason.</p>
  
  <p>One of the images that doesn't work can be found <a href="http://i.imgur.com/MPSIT.jpg" rel="nofollow">here</a></p>
  
  <p>The complete code I use to load it is here</p>
  
  <pre><code>    BitmapFactory.Options o = new BitmapFactory.Options();
      o.inJustDecodeBounds = true;
      BitmapFactory.decodeFile(FILENAME,o);
      int width = o.outWidth;
      int height = o.outHeight;
      /* Width and height decoded successfuly */
  
      BitmapFactory.Options o2 = new BitmapFactory.Options();
      o.inJustDecodeBounds = false;
      Bitmap bitmap = BitmapFactory.decodeFile(FILENAME,o2); 
      /*Bitmap is null */
  </code></pre>
  
  <p>Any idea what is wrong or how it can be circumvented is welcome.</p>