7.对图片进行缩放:
- /** * @param url 图片的路径
- * @param requireSize 缩放的尺寸 * @return 缩放后的图片Bitmap对象
- */ public static Bitmap getScaleImage(String url,int requireSize) {
- BitmapFactory.Options o = new BitmapFactory.Options(); // 此属性表示图片不加载到内存,只是读取图片的属性,包括图片的高宽
- o.inJustDecodeBounds = true; BitmapFactory.decodeFile(url, o);
- int width_tmp = o.outWidth,height_tmp = o.outHeight; int scale = 1;
- while (true) { if (width_tmp / 2 < requireSize || height_tmp / 2 < requireSize)
- break; width_tmp /= 2;










