Abstract: A first aspect of the invention relates to a method for creating a binary mask image from an a inputted digital image of a scanned document, comprising the steps of creating a binarized image by binarizing the inputted digital image, detecting first text regions representing light text on a dark background, and inverting the first text regions, such that the inverted first text regions are interpretable in the same way as dark text on a light background. A second aspect of the invention relates to a method for comparing in a binary image a first pixel blob with a second pixel blob to determine whether they represent matching symbols, comprising the steps of detecting a line in one blob not present in the other and/or determining if one of the blobs represents an italicized symbol where the other does not.