关于如何将已经展示的Imageview数据转换为base64格式的数据
public void getImgbase64(ImageView imageView) {
BitmapDrawable drawable = (BitmapDrawable) imageView.getDrawable();
Bitmap bitmap = drawable.getBitmap();
ByteArrayOutputStream bos = new ByteArrayOutputStream();
bitmap.compress(Bitmap.CompressFormat.PNG, 100, bos);
byte[] bb = bos.toByteArray();
String image = base64.encodeToString(bb, base64.NO_WRAP);
base64 = image;
}
这里的代码逻辑比较清楚,在此不做过多赘述,如有疑问,欢迎在评论区留言。



