How to create an image with GDlib with a transparent background?
header('content-type: image/png');
$image = imagecreatetruecolor(900, 350);
imagealphablending($image, true);
imagesavealpha($image, true);
$text_color = imagecolorallocate($image, 0, 51, 102);
imagestring($image,2,4,4,'Test',$text_color);
imagepng($image);
imagedestroy($image);
Here the background is black
imagefill
and fill that with allocated color (imagecolorallocatealpha) that have alpha set to 0. – Nightshirt