Here you can find the source of from(Drawable drawable)
public static Bitmap from(Drawable drawable)
//package com.java2s; //License from project: Apache License import android.graphics.Bitmap; import android.graphics.drawable.BitmapDrawable; import android.graphics.drawable.Drawable; public class Main { public static Drawable from(Bitmap bitmap) { BitmapDrawable bitDrawable = new BitmapDrawable(bitmap); return bitDrawable; }/* w w w .j a va 2 s . com*/ public static Bitmap from(Drawable drawable) { BitmapDrawable bitDrawable = (BitmapDrawable) drawable; return bitDrawable.getBitmap(); } }