title: Handling progressive jpeg images in Libgdx
body: <p>I am trying to implement a simple Facebook profile picture request functionality into a game that is being developed with Libgdx engine. I would like to get the requested picture and eventually display it on the screen. Preferably, I want this to work both on my desktop and Android implementation.</p>
  
  <p>The problem occurs when I try to create a Pixmap object using the profile picture, as the profile picture is a progressive jpeg, which libgdx cannot load.
  Sample code:</p>
  
  <pre><code>inStream = new URL(url).openStream();
  byte[] buffer = new byte[1024 * 200];
  int readBytes = 0;
  while (true) {
      int length = inStream.read(buffer, readBytes, buffer.length - readBytes);
      if (length == -1)
          break;
      readBytes += length;
  }
  Pixmap pixmap = new Pixmap(buffer, 0, readBytes);
  </code></pre>
  
  <p>Since the image is a downloaded one, I don't have the option to convert the image to a regular jpeg or png format using a software. I've tried using ImageIO package(among some others) to decode the image, but it is not able to handle the progressive jpeg either. I wasn't able to find a solution that would work for both platforms.</p>
  
  <p>Any suggestions to overcome this problem? At least, If I could handle it for Android, maybe I could think of something else for the desktop implementation.</p>