question: private Bitmap decodePreview ( BitmapSource source , int targetSize ) { Bitmap result = source . getPreviewBitmap ( ) ; if ( result == null ) { return null ; } float scale = ( float ) targetSize / ( float ) ( Math . max ( result . getWidth ( ) , result . getHeight ( ) ) ) ; if ( scale <= 0.5 ) { result = BitmapUtils . resizeBitmapByScale ( result , scale , true ) ; } return ensureGLCompatibleBitmap ( result ) ; }
target:  Note that the returned bitmap may have a long edge that's longer than the targetSize, but it will always be less than 2x the targetSize