Link of the day:
http://php.net/image
Look at a basic function that you're likely to need such as imagecreate() and there are loads of examples that branch out to help you do what you want to do.
Failing that plenty of tutorials exist. I suggest webmonkey