public static void writeBitmapToFile(Bitmap bm,File file,int quality) throws IOException {
  FileOutputStream fos=new FileOutputStream(file);
  bm.compress(Bitmap.CompressFormat.JPEG,quality,fos);
  fos.flush();
  fos.close();
}

public static void writeBitmapToFile ( Bitmap bm , File file , int quality ) throws IOException { FileOutputStream fos = new FileOutputStream ( file ) ; bm . compress ( Bitmap . CompressFormat . JPEG , quality , fos ) ; fos . flush ( ) ; fos . close ( ) ; }
write the given bitmap into the given file . jpeg is used as the compression format with quality set to 100 .
