Here you can find the source of getMutableBitmap(Drawable drawable)
public static Bitmap getMutableBitmap(Drawable drawable)
//package com.java2s; //License from project: Open Source License import android.graphics.Bitmap; import android.graphics.Canvas; import android.graphics.drawable.Drawable; public class Main { public static Bitmap getMutableBitmap(Drawable drawable) { if (drawable.getIntrinsicHeight() > 0 && drawable.getIntrinsicWidth() > 0) { Bitmap bitmap = Bitmap.createBitmap( drawable.getIntrinsicWidth(), drawable.getIntrinsicHeight(), Bitmap.Config.RGB_565); Canvas canvas = new Canvas(bitmap); drawable.setBounds(0, 0, canvas.getWidth(), canvas.getHeight()); drawable.draw(canvas);/*from w ww . j av a 2 s. c o m*/ return bitmap; } return null; } }