public Bitmap bigSize(Bitmap b, float Bigwidth, float Bigheight) {
int width= b.getWidth();
int height= b.getHeight();
float sx = (float) Bigwidth/ width;//要强制转换,不转换我的在这总是死掉。
float sy = (float) Bigheight/ height;
Matrix matrix = new Matrix();
matrix.postScale(sx, sy); // 长和宽放大缩小的比例
Bitmap resizeBmp = Bitmap.createBitmap(b, 0, 0, width, height, matrix, true);
return resizeBmp;
}
这里的Bigwidth,Bigheight是指你想要放到到多少像素即放大后的长,宽是多少