The coronal magnetic field, despite its overwhelming importance to the physics and dynamics of the corona, has only rarely been measured. Here, electron density maps derived from images acquired during the total solar eclipse of 2017 August 21 are employed to demonstrate a new technique to measure coronal magnetic fields. The strength of the coronal magnetic fields is derived with a semiempirical formula relating the plasma magnetic energy density to the gravitational potential energy. The resulting values are compared with those provided by more advanced coronal field reconstruction methods based on MHD simulations of the whole corona starting from photospheric field measurements, finding very good agreement. Other parameters such as the plasma β and Alfvén velocity are also derived and compared with those of MHD simulations. Moreover, the plane-of-sky (POS) orientation of the coronal magnetic fields is derived from the observed inclination of the coronal features in filtered images, also finding close agreement with magnetic field reconstructions. Hence, this work demonstrates for the first time that the 2D distribution of coronal electron densities measured during total solar eclipses is sufficient to provide coronal magnetic field strengths and inclinations projected on the POS. These are among the main missing pieces of information that have limited so far our understanding of physical phenomena going on in the solar corona.