1. A method of binarizing a grayscale image into a black and white binary image, said method comprising: selecting a given pixel (P) in the grayscale image; determining the color value (V p ) of P; providing a sub-image (SubI p ) comprising P as well as a number of neighboring pixels; providing a threshold (T p ) of P based on the color values of all the pixels in SubI p ; converting P to black if V p ≦T p or to white if V p >T p ; repeating the above steps for each pixel of the grayscale image; and obtaining a resulting black and white binarized image, wherein the number of pixels in each SubI p is set by performing the steps of the method on a representative sample set of grayscale images with various values of SubI p in the range 0.5 to 1.5 times the average character size of the representative sample set of grayscale images.