The production of Z bosons with one or two isolated high-energy photons is studied using pp collisions at √s=8 TeV. The analyses use a data sample with an integrated luminosity of 20.3 fb−1 collected by the ATLAS detector during the 2012 LHC data taking. The Zγ and Zγγ production cross sections are measured with leptonic (e+e−, μ+μ−, νν¯) decays of the Z boson, in extended fiducial regions defined in terms of the lepton and photon acceptance. They are then compared to cross-section predictions from the Standard Model, where the sources of the photons are radiation off initial-state quarks and radiative Z-boson decay to charged leptons, and from fragmentation of final-state quarks and gluons into photons. The yields of events with photon transverse energy ET>250 GeV from ℓ+ℓ−γ events and with ET>400 GeVfrom νν¯γ events are used to search for anomalous triple gauge-boson couplings ZZγ and Zγγ. The yields of events with diphoton invariant mass mγγ>200 GeV from ℓ+ℓ−γγ events and with mγγ>300 GeV from νν¯γγevents are used to search for anomalous quartic gauge-boson couplings ZZγγand Zγγγ. No deviations from Standard Model predictions are observed and limits are placed on parameters used to describe anomalous triple and quartic gauge-boson couplings.