Pion photoproduction off nuclei: a sensitive test of the nuclear transition densities