1. A method for processing a digital image comprising a plurality of pixels, wherein a pixel from the plurality of pixels may comprise values for one or more color channels, the method comprising the steps of: identifying from the plurality of pixels a set of foreground pixels; selecting at least some of the pixels from the set of foreground pixels and for each selected foreground pixel: classifying pixels in a region surrounding the selected foreground pixel into one of two sets: a first set of pixels comprising pixels in the region that have an intensity that is within an intensity threshold value of the intensity of the selected foreground pixel; and a second set of pixels comprising pixels in the region that do not have an intensity that is within an intensity threshold value of the intensity of the selected foreground pixel; computing a first average intensity of the first sets of pixels and a second average intensity of the second set of pixels; for a digital image with a background generally lighter than its foreground, responsive to the first average intensity being close to or brighter than the second average intensity, classifying the selected foreground pixel as a background pixel; obtaining a filtered image by smoothing the pixels with a foreground label separately from the pixels with a background label; refining the foreground and background pixel labels of the filtered image; using the foreground and background pixel labels to enhance the colors of at least some of the pixels with a foreground label; and further refining the foreground and background pixel labels by regulating shapes of pixel segments; wherein the step of further refining the foreground and background pixel labels by regulating shapes of pixel segments comprises: grouping the foreground pixels into linear segments; responsive to a segment being less than a size threshold value, increasing a thickness of the segment if at least one corresponding orthogonal stroke of the segment exceeds a first long length threshold value and there are no other orthogonal strokes within a first proximity threshold value distance; responsive to a segment being less than the size threshold value, increasing a thickness of the segment if a neighboring segment is within a second proximity threshold value and their corresponding orthogonal strokes are less than a first short length threshold value; and responsive to neighboring segments exceeding a second long length threshold value, connecting the neighboring segments if they are within a third proximity threshold value and their corresponding orthogonal strokes are less than a second short length threshold value.