public static Bitmap resizeImage(Bitmap bitmap,float density){ //按照比例 1 - 0.1
Bitmap bitmapOrg=bitmap;
int width = bitmapOrg.getWidth();
int height = bitmapOrg.getHeight();
Matrix matrix = new Matrix();
matrix.postScale(density, density);
bitmapOrg = Bitmap.createBitmap(bitmapOrg, 0, 0, width,height, matrix, true);
return bitmapOrg;
}
Bitmap BitmapOrg = bitmap;
float scaleWidth = 0, scaleHeight = 0;
int width = BitmapOrg.getWidth();
int height = BitmapOrg.getHeight();
if (w == 1 || w == -1) {
scaleWidth = w;
} else {
scaleWidth = ((float) w) / width;
}
if (h == 1 || h == -1) {
scaleHeight = h;
} else {
scaleHeight = ((float) h) / height;
}
Matrix matrix = new Matrix();
matrix.postScale(scaleWidth, scaleHeight);
BitmapOrg = Bitmap.createBitmap(BitmapOrg, 0, 0, width,
height, matrix, true);
return BitmapOrg;
}
Bitmap bitmapOrg=bitmap;
int width = bitmapOrg.getWidth();
int height = bitmapOrg.getHeight();
Matrix matrix = new Matrix();
matrix.postScale(density, density);
bitmapOrg = Bitmap.createBitmap(bitmapOrg, 0, 0, width,height, matrix, true);
return bitmapOrg;
}
Bitmap BitmapOrg = bitmap;
float scaleWidth = 0, scaleHeight = 0;
int width = BitmapOrg.getWidth();
int height = BitmapOrg.getHeight();
if (w == 1 || w == -1) {
scaleWidth = w;
} else {
scaleWidth = ((float) w) / width;
}
if (h == 1 || h == -1) {
scaleHeight = h;
} else {
scaleHeight = ((float) h) / height;
}
Matrix matrix = new Matrix();
matrix.postScale(scaleWidth, scaleHeight);
BitmapOrg = Bitmap.createBitmap(BitmapOrg, 0, 0, width,
height, matrix, true);
return BitmapOrg;
}