Someone told me that PHP can edit images. Is this true? For example, could I generate a gif header image for an article based on its title in the database?

If this can be done with PHP, could you give me a quick rundown of the techniques? I hope there are some tutorials for this too.