I would like to get a byte array from an jpeg image located in my res/drawable file ?
Does anyone know how to do that please ?
Drawable drawable; Bitmap bitmap = ((BitmapDrawable) drawable).getBitmap(); ByteArrayOutputStream stream = new ByteArrayOutputStream(); bitmap.compress(Bitmap.CompressFormat.JPEG, 100, stream); byte[] bitmapdata = stream.toByteArray();
2.1m questions
2.1m answers
60 comments
57.0k users