Skip to content

Instantly share code, notes, and snippets.

@parzibyte
Created September 27, 2019 22:55
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/b2a6dc082593ae08472350886a377f8e to your computer and use it in GitHub Desktop.
Save parzibyte/b2a6dc082593ae08472350886a377f8e to your computer and use it in GitHub Desktop.
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
bitmap.compress(Bitmap.CompressFormat.PNG, 100, byteArrayOutputStream);
byte[] byteArray = byteArrayOutputStream.toByteArray();
String fotoEnBase64 = Base64.encodeToString(byteArray, Base64.DEFAULT);
// Ahora tenemos el Bitmap en Base64 dentro de la variable fotoEnBase64
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment