Android Base64 returns string much bigger than the image

Viewed 3609

I need to send an image to a server , I have an Image of 3.30 MB size , I convert it to byte array using :

 ByteArrayOutputStream stream = new ByteArrayOutputStream();
    bmp.compress(Bitmap.CompressFormat.PNG, 100, stream);
    byte[] byteArray = stream.toByteArray();

then to base64 using :

Base64.encodeToString(byteArray , Base64.DEFAULT)

EDIT: If I check the length of the byte array (bytearray) it is 20 MB! but on the PC or the phone the size show 3.30 MB

The length of the returned string is 28 MB, any explanation and solution?

3 Answers
Related