Uneven illumination is a recurrent problem in image processing. This is essentially due to image acquisition sensors’ malfunction or external interference. In this paper we propose a variational model for nonuniform illumination correction, that incorporates a penalty term that performs the intensity distribution transfer between two pre-defined sub-regions of the input scalar image, one uniformly illuminated and the other nonuniformly illuminated. This term representing the illumination correction is a Wasserstein distance. It corresponds to the optimal permutation minimizing the cost of rearranging the intensity distribution of the nonuniformly illuminated sub-region into the other, the uniformly illuminated. Simultaneously, this variational model also carries out a regularization of the image by means of a total variation penalty term, to reduce noise. The effectiveness of the model is illustrated for some images.