I want to know how these image generators work.

I can input some text and it will generate an image which will include my text ON the image...


here is an example:
http://txt2pic.com/signs/books/dummi...tag=&time=2320

how is this done in PHP? how can I do it?