renamed writeToBmp to writeBmp