Monday, 18 June 2012

Convert Bitmap into ByteArray


Bitmap bmp = BitmapFactory.decodeResource(getResources(), R.drawable.abstrakt);
ByteArrayOutputStream stream = new ByteArrayOutputStream();
bmp.compress(Bitmap.CompressFormat.PNG, 100, stream);
byte[] byteArray = stream.toByteArray();


Enjoy:--)

Don’t forget to provide feedback or follow this blog, if you find this blog is useful.

2 comments:

  1. It is rendering the image too small with really low pixel density. Any way around it you know??

    Thanks

    ReplyDelete
    Replies
    1. Hello Achin,

      Sorry My Friend, I don't know about this.

      Delete