Share on Google+Share on Google+

php gd background color

This example shows you how to create background color in php gd.


header("Content-type: image/png");

$width = 350;

$height = 360;

$im = ImageCreateTrueColor($width, $height);

$red = ImageColorAllocate($im, 255, 0, 0);

ImageFillToBorder($im, 0, 0, $red, $red);




After running the program you will get the following output


Posted on: October 31, 2009 If you enjoyed this post then why not add us on Google+? Add us to your Circles

Share this Tutorial Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.