write_bmp returns 1 if OK, otherwise - returns 0