把Bitmap转换成二进制

1.

public byte[] getBitmapByte(Bitmap bitmap) {
ByteArrayOutputStream out = new ByteArrayOutputStream();
bitmap.compress(Bitmap.CompressFormat.JPEG, 100, out);
try {
out.flush();
out.close();
}
catch (IOException e) {
e.printStackTrace();
}
return out.toByteArray();
}

 

2.调用getBitmapByte();

byte[] content = getBitmapByte(bm);

你可能感兴趣的:(bitmap)