Skip to content

Instantly share code, notes, and snippets.

@parzibyte
Created September 27, 2019 22:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save parzibyte/353b7f0a6b60a52472e9f5086b0be886 to your computer and use it in GitHub Desktop.
Save parzibyte/353b7f0a6b60a52472e9f5086b0be886 to your computer and use it in GitHub Desktop.
Bitmap bitmap = ((BitmapDrawable) imageViewMuestra.getDrawable()).getBitmap();
if (bitmap != null) {
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
bitmap.compress(Bitmap.CompressFormat.PNG, 100, byteArrayOutputStream);
byte[] byteArray = byteArrayOutputStream.toByteArray();
String fotoEnBase64 = Base64.encodeToString(byteArray, Base64.DEFAULT);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment