Resize Drawable in Android
Here's where I ended up, thanks in part to Saad's answer:
public Drawable scaleImage (Drawable image, float scaleFactor) { if ((image == null) || !(image instanceof BitmapDrawable)) { return image; } Bitmap b = ((BitmapDrawable)image).getBitmap(); int sizeX = Math.round(image.getIntrinsicWidth() * scaleFactor); int sizeY = Math.round(image.getIntrinsicHeight() * scaleFactor); Bitmap bitmapResized = Bitmap.createScaledBitmap(b, sizeX, sizeY, false); image = new BitmapDrawable(getResources(), bitmapResized); return image;}
For the resizing, this is nice and short (the code above wasn't working for me), found here:
ImageView iv = (ImageView) findViewById(R.id.imageView); Bitmap bMap = BitmapFactory.decodeResource(getResources(), R.drawable.picture); Bitmap bMapScaled = Bitmap.createScaledBitmap(bMap, newWidth, newHeight, true); iv.setImageBitmap(bMapScaled);