  Diffuse gamma rays probe the highest-energy processes at the largest scales.
Here we derive model-independent constraints on the hadronic contribution to
the Galactic and extragalactic gamma-ray spectra in the energy range 50 MeV <
E_gamma < 10 GeV. The hadronic component is dominated by emission from neutral
pions, with a characteristic spectrum symmetric about m_{pi^0}/2. We exploit
the well-defined properties of the pion decay spectrum to quantify the maximum
pionic fraction of the observed gamma-ray intensity. We find that the Galactic
spectrum above 30 MeV can be at most about 50% pionic. The maximum pionic
contribution to the extragalactic spectrum is energy dependent; it also depends
on the redshift range over which the sources are distributed, ranging from as
low as about 20% for pions generated very recently, to as much as 90% if the
pions are generated around redshift 10. The implications of these constraints
for models of gamma-ray and neutrino emission are briefly discussed.
