An algorithm for histogram modification via image evolution equations is first presented in this paper. We show that the image histogram can be modified to achieve any given distribution as the steady state solution of this partial differential equation. We then prove that this equation corresponds to a gradient descent flow of a variational problem. That is, the proposed PDE is solving an energy minimization problem. This gives a new interpretation to histogram modification and contrast enhancement in general. This interpretation is completely formulated in the image domain, in contrast with classical techniques for histogram modification which are formulated in a probabilistic domain. From this, new algorithms for contrast enhancement, which include for example, image modeling, can be derived. Based on the energy formulation and its corresponding PDE, we show that the proposed histogram modification algorithm can be combined with denoising schemes. This allows to perform simultaneous contrast enhancement and denoising, avoiding common noise sharpening effects in classical algorithms. The approach is extended to local contrast enhancement as well. Theoretical results regarding the existence of solutions of the proposed equations are presented.