如何将 imageview 转换为 bytearray kotlin android
在 Java 中
Bitmap bitmap = ((BitmapDrawable)image.getDrawable()).getBitmap();
ByteArrayOutputStream stream=new ByteArrayOutputStream();
bitmap.compress(Bitmap.CompressFormat.PNG, 90, stream);
byte[] image=stream.toByteArray();
return image
Run Code Online (Sandbox Code Playgroud)