很简单的一个图片缩放方法,注意要比例设置正确否则可能会内存溢出
相关问题 java.lang.IllegalArgumentException: bitmap size exceeds 32bits 可查看 http://blog.csdn.net/zhouzme/article/details/21732095
public static Bitmap scale(Bitmap bitmap, float scaleWidth, float scaleHeight) {
int width = bitmap.getWidth();
int height = bitmap.getHeight();
Matrix matrix = new Matrix();
matrix.postScale(scaleWidth, scaleHeight);
Log.i(TAG, "scaleWidth:"+ scaleWidth +", scaleHeight:"+ scaleHeight);
return Bitmap.createBitmap(bitmap, 0, 0, width, height, matrix, true);
}