Drawableを byteArrayへ変換

SQLiteの Blobには Drawableを byteArrayに変換して渡してあげれば良いはず。
というわけでググってみると見つかったのが下記ページ。

やっていることは Drawableを Bitmapにして、ByteArrayOutputStreamと Bitmap.CompressFormat.JPGを使って byteArrayに変換してる。

Drawable d; // the drawable (Captain Obvious, to the rescue!!!)
Bitmap bitmap = ((BitmapDrawable)d).getBitmap();
ByteArrayOutputStream stream = new ByteArrayOutputStream();
bitmap.compress(Bitmap.CompressFormat.JPEG, 100, stream);
byte[] bitmapdata = stream.toByteArray();