  We propose a formalism to extract the $\gamma\pi\to\pi\pi$ chiral anomaly
$F_{3\pi}$ from calculations in lattice QCD performed at larger-than-physical
pion masses. To this end, we start from a dispersive representation of the
$\gamma^{(*)}\pi\to\pi\pi$ amplitude, whose main quark-mass dependence arises
from the $\pi\pi$ scattering phase shift and can be derived from chiral
perturbation theory via the inverse-amplitude method. With parameters
constrained by lattice calculations of the $P$-wave phase shift, we use this
combination of dispersion relations and effective field theory to extrapolate
two recent $\gamma^{(*)}\pi\to\pi\pi$ calculations in lattice QCD to the
physical point. Our formalism allows us to extract the radiative coupling of
the $\rho(770)$ meson and, for the first time, the chiral anomaly
$F_{3\pi}=38(16)(11)\,\text{GeV}^{-3}$. The result is consistent with the
chiral prediction albeit within large uncertainties, which will improve in
accordance with progress in future lattice-QCD computations.
