Android缩放图片 Matrix

清华大佬耗费三个月吐血整理的几百G的资源,免费分享!....>>>

int bmpWidth = bmp.getWidth();
int bmpHeight = bmp.getHeight();
/* 设定图片放大的比例 */
double scale = 1.25;
/* 计算这次要放大的比例 */
scaleWidth = (float) (scaleWidth * scale);
scaleHeight = (float) (scaleHeight * scale);
 
/* 产生reSize后的Bitmap对象 */
Matrix matrix = new Matrix();
matrix.postScale(scaleWidth, scaleHeight);
Bitmap resizeBmp = Bitmap.createBitmap(bmp, 0, 0, bmpWidth, bmpHeight,
        matrix, true);