added method to getBase64 String from Bitmap

This commit is contained in:
Robert Abeyta
2015-05-18 14:09:44 -07:00
parent 647e28449d
commit 181e8267f6

View File

@@ -642,6 +642,13 @@ public class MultiImageChooserActivity extends Activity implements OnItemClickLi
Bitmap resizedBitmap = Bitmap.createBitmap(bm, 0, 0, width, height, matrix, false);
return resizedBitmap;
}
private String getBase64OfImage(Bitmap bm) {
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
bm.compress(Bitmap.CompressFormat.JPEG, 100, byteArrayOutputStream);
byte[] byteArray = byteArrayOutputStream .toByteArray();
return Base64.encodeToString(byteArray, Base64.DEFAULT);
}
}
private int calculateInSampleSize(BitmapFactory.Options options, int reqWidth, int reqHeight) {