Android : How to convert the compressed images to string with minimum size

后端 未结 1 962
渐次进展
渐次进展 2021-01-27 07:52

In my android application i am using whatsapp like image compression and after that i convert the compressed image bitmap to string using Base64 encoding,what i noticed is that

相关标签:
1条回答
  • 2021-01-27 08:36

    There's one big difference in your images though.

    The image you store as a file is stored as a JPEG

    bitmapImg.compress(Bitmap.CompressFormat.JPEG, 80, out);
    

    while the Base64 encoded string is a PNG

    bitmapImg.compress(Bitmap.CompressFormat.PNG, 100, byteArrayOS);
    

    This can explain the size differences. Another thing could be, that bitmapImg changed it's contents inbetween both compressions as well.

    0 讨论(0)
提交回复
热议问题