The forward and inverse process of seismic migration and demigration or remodeling has many useful applications in seismic data processing. We evaluated a method to reobtain the seismic reflection data after migration, by inverting the common image point gathers produced by reverse-time migration (RTM) with an extended-imaging condition. This provided a transformation of the results of seismic data processing in the image domain back to the data domain. To be able to reconstruct the data with high fidelity, we set up demigration as a least-squares inverse problem and we solved it iteratively using a steepest-descent method. Because we used an extended-imaging condition, the method is not dependent on an accurate estimate of the migration-velocity field, and it is able to accurately reconstruct both primaries and multiples. At the same time, because the method is based on RTM, it can accurately handle seismic reflection data acquired over complex geologic media. Numerical results showed the feasibility of the method and highlighted some of its applications on 2D synthetic and field data sets.