Imaging the magnetic structure of a material is essential to understanding the influence of the physical and chemical microstructure on its magnetic properties. Magnetic imaging techniques, however, have been unable to probe three-dimensional micrometer-size systems with nanoscale resolution. Here we present the imaging of the magnetic domain configuration of a micrometer-thick FeGd multilayer with hard x-ray dichroic ptychography at energies spanning both the Gd L3 edge and the Fe K edge, providing a high spatial resolution spectroscopic analysis of the complex x-ray magnetic circular dichroism.