1
當我從圖庫中獲取圖片時,圖片看起來很模糊。我使用以下代碼將其大小調整爲250w * 300h:在android中的圖片模糊
if(bm!=null)
{
int width = bm.getWidth();
int height = bm.getHeight();
float scaleWidth = ((float) newWidth)/width;
float scaleHeight = ((float) newHeight)/height;
// create a matrix for the manipulation
Matrix matrix = new Matrix();
// resize the bit map
matrix.postScale(scaleWidth, scaleHeight);
// recreate the new Bitmap
resizedBitmap = Bitmap.createBitmap(bm, 0, 0, width, height, matrix,true);
}
}
catch(Exception e)
{
e.printStackTrace();
}
}
我該如何解決這個問題?