title: How to convert image to string in Android?
body: <p><a href="https://i.stack.imgur.com/VEF8P.png" rel="nofollow noreferrer">It's my MySql DB</a><a href="https://i.stack.imgur.com/GllGw.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/GllGw.png" alt="its my php page that is read streareader"></a>
  Its encoding:-</p>
  
  <pre><code>public String convertBitmapToString(Bitmap bmp) {
     ByteArrayOutputStream stream = new ByteArrayOutputStream();
          bmp.compress(Bitmap.CompressFormat.PNG, 100, stream); //compress to which format you want.
          byte[] byte_arr = stream.toByteArray();
          String imageStr = Base64.encodeToString(byte_arr, 1);
          return imageStr;
  }
  </code></pre>
  
  <p>This is decoding:-</p>
  
  <pre><code>String img=o.toString();
     byte[] imageAsBytes = Base64.decode(img.getBytes(), Base64.DEFAULT);
   imageView.setImageBitmap(BitmapFactory.decodeByteArray(imageAsBytes, 0, imageAsBytes.length));
  </code></pre>
  
  <p>Thank you.</p>