If your PHP installation has GD support included then you have all you need to do this.
Make a test script that calls phpinfo() function and look at the output. Should hopefully have a section about GD. If not, talk to your host and tell them you need GD.
Presuming you have GD, read up on image functions in the PHP Manual. Specifically you'll need to use imagecreate() to create an image resource and imagecolorallocate() to set a colour to use for the image.
imagecolorallocate() uses RGB values to define a colour.