title: Android encoding PNG to base64 string producing invalid results
body: <p>The app decodes base64 to PNG but when I encode the file back to base64 in order to send to a server the resulting base64 is different and does not produce an image.</p>
  
  <p>Here is the start of the original base64 string:
  <code>/9j/4AAQSkZJRgABAQAASABIAAD/4QBMRXhpZgAATU0AKgAAAAgAAgESAAMAAAABAAYAAIdp</code></p>
  
  <p>and here is the start of the base64 after it is encoded from and PNG file:
  <code>iVBORw0KGgoAAAANSUhEUgAAD8AAAAvQCAIAAABPl1n3AAAAA3NCSVQICAjb4U/gAAAgAElEQVR4nO</code></p>
  
  <p>This is the code I'm using to encode the file to base64:</p>
  
  <pre><code>BitmapFactory.Options options = new BitmapFactory.Options();
          options.inDither = true;
          options.inScaled = false;
          options.inPreferredConfig = Bitmap.Config.ARGB_8888;
          options.inDither = false;
  
          File file = new File(root +"/saved_images/"+note.imageLocation );
          if(file.exists()){
              // TODO perform some logging or show user feedback
              try {
              Bitmap myBitmap = BitmapFactory.decodeFile(root +"/saved_images/"+note.imageLocation, options);
              ByteArrayOutputStream stream = new ByteArrayOutputStream();
  
  
              myBitmap.compress(Bitmap.CompressFormat.PNG, 100, stream);
              byte[] byteArray = stream.toByteArray();
  
              JSONObject object =new JSONObject();
                  object.put("image_type", "image/png");
                  object.put("image_data", Base64.encodeToString(byteArray, Base64.DEFAULT));
  
  
                  if (note.serverID == -1) {
                      toReturn.put(String.valueOf(i), object);
                  }else{
                      toReturn.put(String.valueOf(note.serverID), object);
                  }
              } catch (Exception e) {
                  // TODO Auto-generated catch block
                  e.printStackTrace();
              }
  
              i--;
          }else{
              Log.i("File Not Found", "NoteModel - "+file);
          }
  </code></pre>