相关链接:点击打开链接
bitmap图片缩放:
//set bitmap size
public static Bitmap changeSizeOfBmp(String filePath){
BitmapFactory.Options Opts = new BitmapFactory.Options();
Opts.inJustDecodeBounds = true;
Bitmap bitmap = BitmapFactory.decodeFile(filePath,Opts);
Opts.inJustDecodeBounds = false;
int w = Opts.outWidth;
int h = Opts.outHeight;
float hh = 1920f;
float ww = 1080f;
int be = 1;
if (w > h && w > ww) {
be = (int) (Opts.outWidth / ww);
} else if (w < h && h > hh) {
be = (int) (Opts.outHeight / hh);
}
if (be <= 0){
be = 1;
}
Opts.inSampleSize = be;
bitmap = BitmapFactory.decodeFile(filePath, Opts);
return bitmap;
}