Magnetic resonance imaging (MRI) of solids is rarely attempted. One of the main reasons is that the broader MR linewidths, compared to the narrow resonance of the hydrogen (1H) in free water, limit both the attainable spatial resolution and the signal-to-noise ratio. Basic physics research, stimulated by the quest to build a quantum computer, gave rise to a unique MR pulse sequence that offers a solution to this long-standing problem. The quadratic echo significantly narrows the broad MR spectrum of solids. Applying field gradients in sync with this line-narrowing sequence offers a fresh approach to carry out MRI of hard and soft solids with high spatial resolution and with a wide range of potential uses. Here we demonstrate that this method can be used to carry out three-dimensional MRI of the phosphorus (31P) in ex vivo bone and soft tissue samples.