(1) id-->drawable
Drawable drawable = activity.getResources().getDrawable(R.drawable.image1);
(2) id-->Bitmap
Bitmap bitmap = BitmapFactory. decodeResource (Resources res, int id)
(3) Bitmap --> byte
bitmap.compress(Bitmap.CompressFormat.PNG, 100, out);
byte[] array= out.toByteArray();
(4) byte-->bitmap