Convert BitmapDrawable to Bitmap

3.8k views Asked by At

In my project a bitmap gets filled with text and another bitmap, the method to add the text to the bitmap returns a BitmapDrawable.

I want to save this BitmapDrawable as a pdf file, so I can email the original bitmap, with text and other image(s) added.

For this, I'll need a regular Bitmap instead of a BitmapDrawable. I can't seem to find any answers on this, because I don't have a reference to a drawable in a drawable folder, I just have a BitmapDrawable to work with.

Any ideas on this?

1

There are 1 answers

1
Ifrit On BEST ANSWER

BitmapDrawables support a getter for the bitmap.

Bitmap bitmap = bitmapDrawable.getBitmap();