0

I am trying to convert a Base64 string of an image to shorter string. Currently its length is 150356 characters. Is there any way to convert this string under 4000 characters? I have tried MD5 hash but its not working for a longer string.

I am using below code to convert captured image to Base64 in android.

public String uriToBase64(Uri uri){
    String encodedImage = null;
    try{
        final InputStream imageStream = getContentResolver().openInputStream(uri);
        final Bitmap selectedImage = BitmapFactory.decodeStream(imageStream);
        encodedImage = encodeImage(selectedImage);
    }catch (Exception e){
        encodedImage = "";
    }

    return encodedImage;
}
Rahul Singh Chandrabhan
  • 2,531
  • 5
  • 22
  • 33
Shaw
  • 173
  • 2
  • 11

0 Answers0