Large-pT production of single and double photons in proton-proton and pion-proton collisions