1. A computer-implemented method for editing images, comprising: training a neural network with a training image and a composite label generated based at least in part on respective histograms of a plurality of cells of a spatial grid on the training image, wherein the composite label represents an image layout of the training image; generating, based on the neural network, a first feature vector of a target image to represent a first image layout of the target image, and a second feature vector of a reference image to represent a second image layout of the reference image; computing a distance between the first feature vector of the target image and the second feature vector of the reference image; determining the reference image sharing a similar image layout with the target image based on the distance being below a distance threshold; and producing a new image by replacing a first content in the target image with a second content in the reference image.