Reputation: 273
I have an Bitmap image hat i convert to base64, but I want that the image to occupy less because I want to upload that image to a database and it needs to be less than a mb.
Convert from Bitmap to base 64:
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
imagen.compress(Bitmap.CompressFormat.PNG, 100, byteArrayOutputStream);
byte[] byteArray = byteArrayOutputStream.toByteArray();
final String imagenPlanta = Base64.encodeToString(byteArray, Base64.DEFAULT);
Any help would be appreciated.
Upvotes: 0
Views: 605
Reputation: 359
To make it smaller you have to get rid of information. Do something like JPEG, it will focus on removing information that is less relevant, many times a JPEG image looks just fine but is like 10 times smaller.
Upvotes: 2