/** * The original scale of the picture file is abbreviated and not exceeding the maximum width, height * @param path: Picture file * @param requestw: Max width after thumbnail * @param requesth: max height after thumbnail * @return thumbnail image pair Like */public static Bitmap getthumbnailbyreq (String path,int requestw, int requesth) {bitmapfactory.options Options = new Opt Ions ();//Only the source graph size information is parsed, so the source graph boundary information is only loaded into memory, not the full source graph, thus saving memory Options.injustdecodebounds = true; Bitmapfactory.decodefile (path, options); int outw = options.outwidth;//source map width int outh = options.outheight;//source Height// Set the thumbnail multiplier 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;} Need to parse out the correct picture object, so the image of the thumbnail after the complete addition of memory Options.injustdecodebounds = false; Bitmap Bitmap = bitmapfactory.decodefile (path, options); return Bitmap;}
Android pictures with thumbnails