Ptychography is a coherent diffractive imaging method that uses multiple diffraction patterns obtained through the scan of a localized illumination on the specimen. Until recently, reconstruction algorithms for ptychographic datasets needed the a priori knowledge of the incident illumination. A new reconstruction procedure that retrieves both the specimen's image and the illumination profile was recently demonstrated with hard X-ray data. We present here the algorithm in greater details and illustrate its practical applicability with a visible light dataset. Improvements in the quality of the reconstruction are shown and compared to previous reconstruction techniques. Implications for future applications with other types of radiation are discussed.