1. A method comprising: representing an input document image with a sequence of template identifiers to reduce storage consumed by the input document image; and replacing the template identifiers with alphabet characters according to language statistics to generate a text string representative of text in the input document image.