Android Bitmap与byte[]之间的转换1.Bitmap--byte[]:public static byte[] Bitmap2Bytes(Bitmap bm) {Byt
Android Bitmap与byte[]之间的转换
1.Bitmap-->byte[]:
public static byte[] Bitmap2Bytes(Bitmap bm) {ByteArrayOutputStream baos = new ByteArrayOutputStream();bm.compress(Bitmap.CompressFormat.PNG, 100, baos); return baos.toByteArray();}2.byte[]-->Bitmap:
public static Bitmap Bytes2Bimap(byte[] b) {if (b.length == 0) {return null;}return BitmapFactory.decodeByteArray(b, 0, b.length);}? 