How to Get bitmap from drawable: Android

To get Bitmap from resource image

Bitmap bitmap = ((BitmapDrawable)getResources().getDrawable(R.drawable.test)).getBitmap();


It will return the Bitmap 


To get the Bitmap from Imageview

 Drawable imgDrawable = imageview.getDrawable();
 Bitmap bitmap = ((BitmapDrawable) imgDrawable).getBitmap();


Android Exmple to Convert Drawable to Bitmap


How to change app icon Android studio


How do we load Image from Drawable folder with Compose?