The methodology of multiple-wavelength anomalous diffraction, widely used for macromolecular structure determination, is extended to the imaging of nonperiodic nanostructures. We demonstrate the solution of the phase problem by a combination of two resonantly recorded coherent scattering patterns at the carbon K edge (285 eV). Our approach merges iterative phase retrieval and x-ray holography approaches, yielding unique and rapid reconstructions. The element, chemical, and magnetic state specificity of our method further renders it widely applicable to a broad range of nanostructures, providing a spatial resolution that is limited, in principle, by wavelength only.