This is a relatively easy process. See the function below. It takes a Bitmap variable and outputs a string.
ByteArrayOutputStream stream = new ByteArrayOutputStream();
ico.compress(Bitmap.CompressFormat.PNG, 100, stream);
byte[] byteArray = stream.toByteArray();
return Base64.encodeToString(byteArray, Base64.DEFAULT);
}
No comments:
Post a Comment