I'm currently using the following method to convert a bitmap into a Base64 encoded string, however for very big images I'm getting an OutOfMemory error:
public static String convertBitmapToBase64String(Bitmap bmp) throws OutOfMemoryError
{
ByteArrayOutputStream baos = new ByteArrayOutputStream();
bmp.compress(Bitmap.CompressFormat.JPEG, 100, baos);
byte[] byteArrayImage = baos.toByteArray();
String base64EncodedImg = Base64.encodeToString(byteArrayImage, Base64.DEFAULT);
return base64EncodedImg;
}
I saw this answer, however it uses IOUtils: https://stackoverflow.com/a/24877734/720175
Is it possible to do convert a large bitmap into a base64 encoded string using only standard libraries normally included?