Recently, we numerically showed that, for a nonminimal coupling that is a simple power of the scale factor, scale invariant magnetic fields arise in a class of bouncing universes. In this work, we analytically evaluate the spectrum of magnetic and electric fields generated in a subclass of such models. We illustrate that, for cosmological scales which have wave numbers much smaller than the wave number associated with the bounce, the shape of the spectrum is preserved across the bounce. Using the analytic solutions obtained, we also illustrate that the problem of backreaction is severe at the bounce. Finally, we show that the power spectrum of the magnetic field remains invariant under a two-parameter family of transformations of the nonminimal coupling function. © 2016 American Physical Society.