title: Not able to convert Bitmap to perfect Base64 String in Android?
body: <p>I am working on an application in which I need to capture an Image from camera. After capture, I have to <strong>convert the Bitmap to Base64</strong>. After converting to Base64, I have to send that String to SERVER. I am using below code for this task:</p>
  
  <pre><code>ByteArrayOutputStream baos = new ByteArrayOutputStream();
  image.compress(Bitmap.CompressFormat.PNG, 100, baos);
  byte[] b = baos.toByteArray();
  base64Image = Base64.encodeToString(b,Base64.DEFAULT);
  </code></pre>
  
  <p><strong>Problem :</strong> When I convert that Base64 to image, I am getting INCOMPLETE IMAGE. The same result is happening over server where my image is not perfectly re-constructed from Base64 String. </p>
  
  <p>Please suggest me the solution. I have already search a-lot and getting same code which I am using right now. </p>
  
  <p><strong>Edited: please see the below incomplete Image</strong></p>
  
  <p><img src="https://i.stack.imgur.com/uMLrV.png" alt="enter image description here"></p>
  
  <p>Code use to capture the Image:</p>
  
  <pre><code>intent = new Intent("android.media.action.IMAGE_CAPTURE");
  startActivityForResult(intent, TAKE_PHOTO);
  </code></pre>