question: public static byte [ ] bitmapToJpg ( final Bitmap image , final int quality ) { if ( image == null ) return null ; ByteArrayOutputStream ba = new ByteArrayOutputStream ( ) ; if ( image . compress ( CompressFormat . JPEG , quality , ba ) ) return ba . toByteArray ( ) ; else return null ; }
target:  Bitmap into compressed jpeg