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.
if image is of 2 mb and above then this code throws out of memory error.
ReplyDelete