Method 1:/*** get the local image and specify the height and width */public static bitmap getnativeimage (string ImagePath) {bitmapfactory. options = new bitmapfactory. options (); options. injustdecodebounds = true; // obtain the width and height of the image. Bitmap mybitmap = bitmapfactory. decodefile (ImagePath, options); // at this time, the returned mybitmap is null // calculate the zoom ratio int be = (INT) (options. outheight/(float) 200); int ys = options. outheight % 200; // calculate the remainder float Fe = YS/(float) 200; If (Fe> = 0.5) be = be + 1; if (be <= 0) be = 1; options. insamplesize = be; // re-read the image. Note that options should be added this time. injustdecodebounds is set to falseoptions. injustdecodebounds = false; mybitmap = bitmapfactory. decodefile (ImagePath, options); Return mybitmap;} Method 2: /*** read images of local resources in the most memory-saving mode * @ Param context * @ Param resid * @ return */public static bitmap readbitmap (context, int resid) {bitmapfactory. options opt = new bitmapfactory. options (); OPT. inpreferredconfig = bitmap. config. rgb_565; OPT. inpurgeable = true; OPT. ininputtransferable = true; // obtain the resource image inputstream is = context. getresources (). openrawresource (resid); Return bitmapfactory. decodestream (is, null, OPT);} method 3: /*** use the most memory-saving method to read images from local resources or images in sdcard * @ Param ImagePath * path of the image in sdcard * @ return */public static bitmap getsdcardimg (string ImagePath) {bitmapfactory. options opt = new bitmapfactory. options (); OPT. inpreferredconfig = bitmap. config. rgb_565; OPT. inpurgeable = true; OPT. ininputretriable = true; // obtain the resource image return bitmapfactory. decodefile (ImagePath, OPT );}