//DEFINE CONTENT TYPE
Header("Content-type: image/png");
//DEFINE BACKGROUND SIZE
$height = 300;
$width = 300;
//TELLS IT TO CREATE BACK (IMAGE) AT DEFINED SIZE
$im = ImageCreate($width, $height);
//TELLS IT WHAT COLOR TO MAKE YOUR BACK (IMAGE)
$bck = ImageColorAllocate($im, 255,255,255);
// SET BACK TO TRANSPARENT.
ImageColorTransparent($im, $bck);
// MAKE YOUR BACKGROUND SHAPE.
imagefilledrectangle($im, 0, 0, 300, 300, $bck);
//MAKE BRUSH
$brush = imagecreatefromgif("toast.gif");
// BRUSH COLOR IS WHITE
$w2 = imagecolorallocate($brush, 255, 255, 255);
// MAKE BRUSH COLOR TRANSPARENT. ONLY THE "PNG"
// WILL SHOW.
imagecolortransparent($brush, $w2);
// SET THE BRUSH.
imagesetbrush($im, $brush);
//COLOR VARIABLES
$maroon = ImageColorAllocate($im, 128, 0, 0);
$pink = ImageColorAllocate($im, 255, 192, 203);
$dodger = ImageColorAllocate($im, 30, 144, 255);
$burly = ImageColorAllocate($im, 222, 184, 135);
$brown = ImageColorAllocate($im, 102, 51, 0);
$seagreen = ImageColorAllocate($im, 46, 139, 87);
$mseagreen = ImageColorAllocate($im, 60, 179, 113);
$grey = imagecolorallocate($im, 128, 128, 128);
$black =imagecolorallocate($im, 0, 0, 0);
$white = ImageColorAllocate($im, 255, 255, 255);
$lace = ImageColorAllocate($im, 253, 245, 230);
$goldenrod = ImageColorAllocate($im, 218, 165, 32);
$Red = ImageColorAllocate($im, 255, 0, 0);
//FUNCTIONS
//THIS SETS THICKNESS OF LINE, DEFAULT IS 1
imagesetthickness ($im, 4);
//DRAW A CIRCLE WITH DODGER
imageEllipse ($im, 150, 150, 240, 240, $dodger);
imageFilledEllipse ($im, 150, 150, 240, 240, $goldenrod);
//DRAW A SERIES OF LINES
imageLine ($im, 150, 30, 150, 270, $dodger);
imageLine ($im, 30, 150, 270, 150, $dodger);
imageLine ($im, 60, 230, 240, 70, $dodger);
imageLine ($im, 60, 70, 240, 230, $dodger);
//DRAW A CIRCLE FOR FACE
imagefilledEllipse ($im, 150, 170, 170, 170, $bck);
imagefilledEllipse ($im, 150, 170, 170, 170, $Red);
imagefilledEllipse ($im, 150, 170, 170, 170, $pink);
imageEllipse($im, 150, 170, 170, 170, $black);
//DRAW A CIRCLE-EARS
imagefilledEllipse ($im, 90, 110, 90, 80, $bck);
imagefilledEllipse ($im, 90, 110, 90, 80, $white);
imagefilledEllipse ($im, 90, 110, 90, 80, $pink);
imagefilledEllipse ($im, 210, 110, 90, 80, $bck);
imagefilledEllipse ($im, 210, 110, 90, 80, $white);
imagefilledEllipse ($im, 210, 110, 90, 80, $pink);
//DRAW EYES
imagefilledEllipse ($im, 124, 135, 29, 49, $black);
imagefilledEllipse ($im, 176, 135, 29, 49, $black);
imagefilledEllipse ($im, 124, 135, 19, 39, $white);
imagefilledEllipse ($im, 176, 135, 19, 39, $white);
imagefilledEllipse ($im, 124, 145, 19, 30, $black);
imagefilledEllipse ($im, 176, 145, 19, 30, $black);
//DRAW ARC UNDER EYES
imageArc ($im, 150, 175, 65, 50, 200, 350, $black);
//DRAW ARC ON CHIN
imageArc ($im, 150, 240, 45, 25, 0, 180, $black);
//DRAW NOSE
imagefilledEllipse ($im, 150, 180, 40, 20, $black);
imagefilledEllipse ($im, 150, 180, 10, 5, $white);
//DRAW MOUTH
imagesetthickness($im, 4);
imageArc ($im, 150, 190, 100, 50, 0, 180, $black);
imageArc ($im, 150, 215, 40, 25, 0, 180, $black);
imageFill ($im, 150, 220, $black);
imagefilledEllipse ($im, 150, 220, 20, 10, $maroon);
imageArc ($im, 95, 180, 15, 50, 0, 90, $black);
imageArc ($im, 205, 180, 15, 50, 90, 180, $black);
//DRAW FOREHEAD
imageArc ($im, 180, 135, 60, 70, 180, 40, $brush);
imageArc ($im, 120, 135, 60, 70, 150, 0, $brush);
imageArc ($im, 205, 190, 60, 75, 270, 0, $brush);
imageArc ($im, 95, 190, 60, 75, 180, 270, $brush);
imageFill ($im, 100, 100, $black);
//SHOW IMAGE OUTPUT AS PNG
//$im = imagecreatefrompng("test.png");
ImagePNG($im);
//FREE THE IMAGE (CLEAR FROM CACHE)
imagedestroy($im);
?>


image used for the brush
Brush