Measurements are presented of Wγγ and Zγγ production in proton-proton collisions. Fiducial cross sections are reported based on a data sample corresponding to an integrated luminosity of 19.4 fb−1 collected with the CMS detector at a center-of-mass energy of 8 TeV. Signal is identified through the W → ℓν and Z → ℓℓ decay modes, where ℓ is a muon or an electron. The production of Wγγ and Zγγ, measured with significances of 2.6 and 5.9 standard deviations, respectively, is consistent with standard model predictions. In addition, limits on anomalous quartic gauge couplings in Wγγ production are determined in the context of a dimension-8 effective field theory.[Figure not available: see fulltext.].