question: private static byte [ ] save ( Bitmap src , Bitmap . CompressFormat format , int quality ) { ByteArrayOutputStream outputStream = null ; try { outputStream = new ByteArrayOutputStream ( ) ; src . compress ( format , quality , outputStream ) ; return outputStream . toByteArray ( ) ; } finally { if ( outputStream != null ) { try { outputStream . close ( ) ; } catch ( IOException e1 ) { e1 . printStackTrace ( ) ; } } } }
target:  Saving image to byte array