  The generation of large-scale magnetic fields is studied in inflationary
cosmology. We consider the violation of the conformal invariance of the Maxwell
field by dilatonic as well as non-minimal gravitational couplings. We derive a
general formula for the spectrum of large-scale magnetic fields for a general
form of the coupling term and the formula for the spectral index. The result
tells us clearly the (necessary) condition for the generation of magnetic
fields with sufficiently large amplitude.
