The imagecolorset() function sets the color for the specified palette index. Using this create flood-fill-like effects in palleted images.
Syntax
imagecolorset ( img, index, red, green, blue, alpha )
Parameters
img: Image created with imagecreatetruecolor() function
index: The index in the palette image
red: Value of red component
green: Value of green component
blue: Value of blue component
alpha: The transparency if image.
Return
The imagecolorset() function returns nothing.
Example
The following is an example
<?php
$img = imagecreate(550, 400);
imagecolorallocate($img, 0, 0, 0);
$bgcolor = imagecolorat($img, 70, 85);
imagecolorset($img, $bgcolor, 30, 110, 150);
header('Content-Type: image/png');
imagepng($img);
imagedestroy($img);
?>Output
The following is the output:
