  We describe a powerful method for determining the equation of state of an
ultracold gas from in situ images. The method provides a measurement of the
local pressure of an harmonically trapped gas and we give several applications
to Bose and Fermi gases. We obtain the grand-canonical equation of state of a
spin-balanced Fermi gas with resonant interactions as a function of
temperature. We compare our equation of state with an equation of state
measured by the Tokyo group, that reveals a significant difference in the
high-temperature regime. The normal phase, at low temperature, is well
described by a Landau Fermi liquid model, and we observe a clear thermodynamic
signature of the superfluid transition. In a second part we apply the same
procedure to Bose gases. From a single image of a quasi ideal Bose gas we
determine the equation of state from the classical to the condensed regime.
Finally the method is applied to a Bose gas in a 3D optical lattice in the Mott
insulator regime. Our equation of state directly reveals the Mott insulator
behavior and is suited to investigate finite-temperature effects.
