Share on Google+Share on Google+

PHP GD Gradient Fill

This example shows how display gradient fill in php gd.


$image = ImageCreate(200, 200);

for($i=0; $i<255; $i++) {

$background_color = ImageColorAllocate($image, $i, $i, $i);


$text_color = ImageColorAllocate($image, 255, 255, 255);

$tekst = "Roseindia";

ImageString($image, 4, 30, 50, "$tekst", $text_color);

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





After running the program you will get the following output


Posted on: November 9, 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.


Advertisement null