title: Upload image to server as base64 string without reducing the quality
body: <p>I am trying to upload images to remote server. While compressing the image quality is getting reduced and Without compressing the image is covered with a white layer. How to upload a good quality image to the server.</p>
  
  <pre><code>    private void uploadImage(String photoPath) {
      BitmapFactory.Options bmOptions = new BitmapFactory.Options();
      bmOptions.inJustDecodeBounds = true;
      BitmapFactory.decodeFile(photoPath, bmOptions);
      bmOptions.inJustDecodeBounds = false;
      bmOptions.inSampleSize = 9;
      bmOptions.inPurgeable = true;
      mPhotoBitmap = BitmapFactory.decodeFile(photoPath, bmOptions);
  
      ByteArrayOutputStream stream = new ByteArrayOutputStream();
      if (mPhotoBitmap != null) {
          mPhotoBitmap.compress(Bitmap.CompressFormat.JPEG, 100, stream);
          byte[] ImgbyteArray = stream.toByteArray();
          photoBase64 = new String(Base64.encode(ImgbyteArray, Base64.DEFAULT));
      }
  }
  </code></pre>
  
  <p>Tried like this but the base64 giving a white image...</p>