Created
February 13, 2017 18:10
-
-
Save zurche/d952293f4027f7ddaec0071b76352101 to your computer and use it in GitHub Desktop.
This encodes a bitmap in base64
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private String encodeImage(Bitmap bitmap) { | |
ByteArrayOutputStream baos = new ByteArrayOutputStream(); | |
bitmap.compress(Bitmap.CompressFormat.JPEG, 100, baos); | |
byte[] byteArray = baos.toByteArray(); | |
return Base64.encodeToString(byteArray, Base64.DEFAULT); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment