Picture looks blurry when I get it from gallery. I resize to 250w*300h using the following code:
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();
}
}
How can I solve this?.
You don’t need matrix manipulation just use
I am not sure how do you calculate newWidth and newHeight, but it could be that your new scaled bitmap is too small and then streaches in a view hence blurred.