A method of operating on an image of a document includes, for an
electronic file that includes a representation of the document,
portioning the representation of the document into non-overlapping areas.
Each area includes a matrix of pixels and each pixel has an initial
grayscale value and a position in the matrix. The method also includes,
for each area, determining a black point value and a white point value.
The method further includes, for each pixel in each area, determining a
revised pixel grayscale value for the pixel using the pixel's grayscale
value, the pixel's position in the matrix, the black point value for the
area comprising the pixel, the white point value for the area comprising
the pixel, the black point value for at least one area adjacent to the
area comprising the pixel, and/or the white point value for at least one
area adjacent to the area comprising the pixel. The method also includes
producing the image of the document using the revised grayscale values
for each pixel.