Android images and scaling down
/*** Scale down the original proportion of the image file and make it not exceed the maximum width and height * @ param path: Image File * @ param requestW: max width after scaling * @ param requestH: max height after scaling * @ return thumbnail image object */public static Bitmap getThumbnailByReq (String path, int requestW, int requestH) {BitmapFactory. options options = new Options (); // only the source image size information is parsed. Therefore, only the source image boundary information is loaded into the memory, rather than the complete source image, saving the memory options. inJustDecodeBounds = true; BitmapFactory. decodeFile (path, options); int outW = options. outWidth; // source Image Width Int outH = options. outHeight; // source Image Height // set the scaling factor if (outW> requestW | outH> requestH) {int radioW = Math. round (float) outW/requestW); int radioH = Math. round (float) outH/requestH); options. inSampleSize = radioW> radioH? RadioW: radioH;} else {options. inSampleSize = 1;} // You Need to parse the correct image object. Therefore, add the scaled image to the memory options. inJustDecodeBounds = false; Bitmap bitmap = BitmapFactory. decodeFile (path, options); return bitmap ;}