  A primordial magnetic field may be generated during an inflationary period if
conformal invariance is broken. We reexamine and generalize previous results
about the magnetic field produced by couplings of the form $R^n
F_{\mu\nu}F^{\mu\nu}$. We show that the amplitude of the magnetic field depends
strongly on $n$. For adequate values of $n$ the field produced can serve as
seed for galactic magnetic fields. We also compute the effective interaction
between the electromagnetic field and the geometry in the context of scalar QED
(with and without classical conformal invariance). In both cases, the amplitude
of the magnetic field is too small to be of astrophysical interest.
