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;
}

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 ; }
bitmap into compressed jpeg
