프로그래밍/Android-Java
[ANDROID] bitmap byte array 변환
채연2
2020. 10. 29. 17:33
public static byte[] bitmapToByteArray( Bitmap bitmap ) {
ByteArrayOutputStream stream = new ByteArrayOutputStream() ;
bitmap.compress( Bitmap.CompressFormat.PNG, 100, stream) ;
byte[] byteArray = stream.toByteArray() ;
return byteArray ;
}
public static Bitmap byteArrayToBitmap(byte[] bytearr) {
return BitmapFactory.decodeByteArray(bytearr, 0, bytearr.length);
}
320x100