question: public Bitmap readImage ( String imagePath , int maxWidth , int maxHeight ) { File imageFile = new File ( imagePath ) ; if ( imageFile . exists ( ) ) { BufferedInputStream inputStream = null ; try { inputStream = new BufferedInputStream ( new FileInputStream ( imageFile ) ) ; BitmapFactory . Options options = new BitmapFactory . Options ( ) ; options . inJustDecodeBounds = true ; BitmapFactory . decodeStream ( inputStream , null , options ) ; inputStream . close ( ) ; int i = 0 ; while ( true ) { if ( ( options . outWidth > > i <= maxWidth ) && ( options . outHeight > > i <= maxHeight ) ) { inputStream = new BufferedInputStream ( new FileInputStream ( new File ( imagePath ) ) ) ; options . inSampleSize = ( int ) Math . pow ( 2.0 , i ) ; options . inJustDecodeBounds = false ; Bitmap bitmap = BitmapFactory . decodeStream ( inputStream , null , options ) ; inputStream . close ( ) ; return bitmap ; } i += 1 ; } } catch ( IOException e ) { Logger . e ( e , "This path does not exist" + imagePath + "." ) ; } finally { IOUtils . closeQuietly ( inputStream ) ; } } return null ; }
target:  Deposit in the province read images, width is high, the greater the picture clearer, but also the memory.