A method for enhancing a textual image for undergoing optical character recognition, comprising: receiving an image that includes native lines of text; performing edge detection on the native lines to produce a representation of the native lines in edge space; detecting connected components in the native lines represented in the edge space; determining a background line profile that represents an average background intensity along the native lines in the image; determining a foreground line profile that represents an average foreground intensity along the native lines in the image, wherein determining the background and foreground line profiles includes determining a plurality of background and foreground intensity values for a plurality of localized regions along each of the native lines represented in edge space; estimating an average or median stroke width of connected components representing text in the image; enhancing text quality if the average or median stroke width is less than a threshold value, the enhancing comprising: assigning pixels in the image having an intensity less than a selected parameter to a foreground portion of the image, wherein the selected parameter is determined at least in part from the background line profile and the foreground line profile; assigning pixels in the image having an intensity greater than the background line profile to the background portion of the image; and assigning selected pixels having an intensity between the selected parameter and the background line profile to base connected components of the native lines represented in edge space by incrementally adding sets of pixels with increasingly higher intensities, wherein each set defines pixels having an intensity within one of a finite set of intensity intervals; and terminating assigning selected pixels to at least one of the base connected components when a distance between an edge pixel and a skeleton pixel of the base connected component is greater than half the average or median stroke width. receiving an image that includes native lines of text; performing edge detection on the native lines to produce a representation of the native lines in edge space; detecting connected components in the native lines represented in the edge space; determining a background line profile that represents an average background intensity along the native lines in the image; determining a foreground line profile that represents an average foreground intensity along the native lines in the image, wherein determining the background and foreground line profiles includes determining a plurality of background and foreground intensity values for a plurality of localized regions along each of the native lines represented in edge space; estimating an average or median stroke width of connected components representing text in the image; enhancing text quality if the average or median stroke width is less than a threshold value, the enhancing comprising: assigning pixels in the image having an intensity less than a selected parameter to a foreground portion of the image, wherein the selected parameter is determined at least in part from the background line profile and the foreground line profile; assigning pixels in the image having an intensity greater than the background line profile to the background portion of the image; and assigning selected pixels having an intensity between the selected parameter and the background line profile to base connected components of the native lines represented in edge space by incrementally adding sets of pixels with increasingly higher intensities, wherein each set defines pixels having an intensity within one of a finite set of intensity intervals; and terminating assigning selected pixels to at least one of the base connected components when a distance between an edge pixel and a skeleton pixel of the base connected component is greater than half the average or median stroke width. assigning pixels in the image having an intensity less than a selected parameter to a foreground portion of the image, wherein the selected parameter is determined at least in part from the background line profile and the foreground line profile; assigning pixels in the image having an intensity greater than the background line profile to the background portion of the image; and assigning selected pixels having an intensity between the selected parameter and the background line profile to base connected components of the native lines represented in edge space by incrementally adding sets of pixels with increasingly higher intensities, wherein each set defines pixels having an intensity within one of a finite set of intensity intervals; and terminating assigning selected pixels to at least one of the base connected components when a distance between an edge pixel and a skeleton pixel of the base connected component is greater than half the average or median stroke width.