1. A computer-readable medium having stored thereon computer-executable instructions for programming a processor to operate on an image of a document, wherein the instructions program the processor to: for an electronic file comprising a representation of the document, portion the representation of the document into non-overlapping areas, each area comprising a matrix of pixels, each pixel having an initial grayscale value and a position in the matrix; for each area, determine a black point value and a white point value; for each pixel in each area, determine a revised pixel grayscale value for each pixel using one or more selections from the group consisting of: each pixel's grayscale value; each pixel's position in the matrix; the black point value for each area comprising each pixel; the white point value for each area comprising each pixel; the black point value for at least one area adjacent to each area comprising each pixel; and the white point value for at least one area adjacent to each area comprising each pixel, wherein the determining of the revised pixel grayscale value for each pixel further comprises: calculating a weighted black point (WBP) for each pixel; calculating a weighted white point (WWP) for each pixel; calculating a scale factor (SF) for each pixel using the formula SF=(GS/(WWP−WBP)), wherein GS is the number of possible values for each pixel's grayscale value; and calculating the revised pixel grayscale value using the formula RPV=(PV−WBP)×SF, wherein PV is the pixel's initial grayscale value; and produce the image of the document using the revised grayscale values for each pixel.