It'll be really easy--use imagecopymerge() onto a new image that only has one solid color. Here's a step-by-step synopsis:
1) Create your original image, the one from the previous image
2) Create a buffer image with the background color you want to fade out to.
3) imagecopymerge() step 1's image onto step 2's image with 100-% you want it to fade (it is opacity, not amount unmerged). For instance, if you want it to fade away 15%, you would use 85.
4) Destroy the first image.
You're left over with the image from step 2, which is now faded.