publicstaticBitmap ResizeBitmap(Bitmap bitmap, intnewWidth) {
intwidth = bitmap.getWidth();
intheight = bitmap.getHeight();
floattemp = ((float) height) / ((float) width);
intnewHeight = (int) ((newWidth) * temp);
floatscaleWidth = ((float) newWidth) / width;
floatscaleHeight = ((float) newHeight) / height;
Matrix matrix = newMatrix();
// resize the bit map
matrix.postScale(scaleWidth, scaleHeight);
// matrix.postRotate(45);
Bitmap resizedBitmap = Bitmap.createBitmap(bitmap, 0, 0, width, height, matrix, true);
bitmap.recycle();
returnresizedBitmap;
}