when i am converting image file into base64 size of image increased 3 times, can anyone please explain ?? Ideally it should increase 30% to 40%.
Bitmap bitmap = BitmapFactory.decodeFile(file.getAbsolutePath());
ByteArrayOutputStream stream = new ByteArrayOutputStream();
bitmap.compress(Bitmap.CompressFormat.JPEG, 100, stream);
byte[] image = stream1.toByteArray();
str = Base64.encodeToString(image, Base64.NO_WRAP);
You are not encoding the original jpg file. If you did that the base64 encoded string would have 30 % bytes more than the original file.
Instead you load the jpg in a Bitmap and then let the Bitmap compress it to a different jpg file in memory. This second one is already much bigger then the original one. You can check that easily.
So do not use an intermediate Bitmap but encode the bytes of the original file directly.