public static Bitmap bitmapRoom(Bitmap srcBitmap,int newWidth,int newHeight)
{
int srcWidth = srcBitmap.getWidth();
int srcHeight = srcBitmap.getHeight();
float scaleWidth = ((float) newWidth) / srcWidth;
float scaleHeight = ((float) newHeight) / srcHeight;
Matrix matrix = new Matrix();
matrix.postScale(scaleWidth, scaleHeight);
Bitmap resizedBitmap = Bitmap.createBitmap(srcBitmap, 0, 0, srcWidth,
srcHeight, matrix, true);
if(resizedBitmap != null)
{
return resizedBitmap;
}
else
{
return srcBitmap;
}
}
bimap压缩
最新推荐文章于 2024-06-14 09:48:13 发布