We produce YbF molecules with a density of 10 18 m −3 using laser ablation inside a cryogenicallycooled cell filled with a helium buffer gas. Using absorption imaging and absorption spectroscopy we study the formation, diffusion, thermalization and optical pumping of the molecules. The absorption images show an initial rapid expansion of molecules away from the ablation target followed by a much slower diffusion to the cell walls. We study how the time constant for diffusion depends on the helium density and temperature, and obtain values for the YbF-He diffusion cross-section at two different temperatures. We measure the translational and rotational temperatures of the molecules as a function of time since formation, obtain the characteristic time constant for the molecules to thermalize with the cell walls, and elucidate the process responsible for limiting this thermalization rate. Finally, we make a detailed study of how the absorption of the probe laser saturates as its intensity increases, showing that the saturation intensity is proportional to the helium density. We use this to estimate collision rates and the density of molecules in the cell.