What you're trying to do is called OCR, happy googleing :-)