An iterative algorithm is developed to retrieve the complex exit-face wavefunction for a two-dimensional projection of a nanoparticle from a measurement of the oversampled modulus of its Fourier transform in reciprocal space. The algorithm does not require the support (boundary) of the object to be known. A loose support for the complex object is gradually found using the Oszlanyi-Suto charge-flipping algorithm, and a compact support is then iteratively developed using a dynamic Gerchberg-Saxton-Fienup algorithm. At the same time, the complex object is reconstructed using this compact support. The algorithm applies to the reconstruction of complex images with any distribution of phase values from 0 to 2pi. Modification of the algorithm by using real-value constraints for a complex object in the charge-flipping algorithm leads to faster reconstruction of the object whose phase value is smaller than pi/2.