Java tutorial
//package com.java2s; import android.graphics.Bitmap; import android.graphics.Bitmap.Config; import android.graphics.Canvas; import android.graphics.Matrix; import android.graphics.drawable.PictureDrawable; public class Main { private static Bitmap pictureDrawable2Bitmap(PictureDrawable pictureDrawable) { float intrinsicWidth = (float) pictureDrawable.getIntrinsicWidth(); float intrinsicHeight = (float) pictureDrawable.getIntrinsicHeight(); float f = 1.0f; if (intrinsicWidth < 600.0f || intrinsicHeight < 600.0f) { f = Math.min(600.0f / intrinsicWidth, 600.0f / intrinsicHeight); intrinsicWidth = (intrinsicWidth * f) + 0.5f; intrinsicHeight = (intrinsicHeight * f) + 0.5f; } Bitmap createBitmap = Bitmap.createBitmap((int) intrinsicWidth, (int) intrinsicHeight, Config.ARGB_8888); Canvas canvas = new Canvas(createBitmap); Matrix matrix = new Matrix(); matrix.preScale(f, f); canvas.concat(matrix); canvas.drawPicture(pictureDrawable.getPicture()); return createBitmap; } }