question: private static Bitmap createSquareBitmap ( Bitmap bitmap ) { Bitmap resizedBitmap = null ; if ( null != bitmap ) { int width = bitmap . getWidth ( ) ; int height = bitmap . getHeight ( ) ; if ( width == height ) { resizedBitmap = bitmap ; } else if ( width > height ) { resizedBitmap = Bitmap . createBitmap ( bitmap , ( width - height ) / 2 , 0 , height , height ) ; } else { resizedBitmap = Bitmap . createBitmap ( bitmap , 0 , ( height - width ) / 2 , width , width ) ; } } return resizedBitmap ; }
target:  Create a square bitmap from another one. It is centered.