1. A method for enhancing digital images, comprising: accessing an input image comprising a background and a foreground; determining, by at least one processor, modifications to enhance the input image by minimizing an energy heuristic that both causes pixels of the input image to change to a uniform color and preserves gradients from the input image; and generating, by the at least one processor, an output image with an enhanced foreground by applying the determined modifications to the input image.