Thank you for your responses. Here is how I finally resolved this:
Bitmap bitmapOrg = BitmapFactory.decodeResource(getResources(), R.drawable.ic_launcher); Bitmap bitmap = bitmapOrg; ByteArrayOutputStream stream = new ByteArrayOutputStream(); bitmap.compress(Bitmap.CompressFormat.JPEG, 100, stream); byte[] imageInByte = stream.toByteArray(); long lengthbmp = imageInByte.length;
Appreciate your time and answers :)
Ahmed source share