Text this: Pattern recognition and image preprocessing