I noticed that this has gone unanswered for quite some time. I don't think that this is easily possible for ANY programming language. You're talking about writing OCR (Optical Character Recognition) software using a simple scripting language.
It's much easier for people to recognize language as a graphic than it is for computers to, which is why so many sites use a "type the word in the picture" type verification system to ensure that a real person is making a purchase or registering a user account, etc...
If one could just whip up a PHP script to do that, one would think that so many sites wouldn't rely on that type of system for verification!