public static Bitmap resize ( @ NonNull final Bitmap bitmap , final int width , final int height ) { Condition . INSTANCE . ensureNotNull ( bitmap , "The bitmap may not be null" ) ; Condition . INSTANCE . ensureAtLeast ( width , 1 , "The width must be at least 1" ) ; Condition . INSTANCE . ensureAtLeast ( height , 1 , "The height must be at least 1" ) ; return Bitmap . createScaledBitmap ( bitmap , width , height , false ) ; }
Resizes a bitmap to a specific width and height . If the ratio between width and height differs from the bitmap s original ratio the bitmap is stretched .