<?php
// eine 200*200-Grafik erstellen
$img = imagecreatetruecolor(200, 200);
// Farben vorbereiten
$white = imagecolorallocate($img, 255, 255, 255);
$red = imagecolorallocate($img, 255, 0, 0);
$green = imagecolorallocate($img, 0, 255, 0);
$blue = imagecolorallocate($img, 0, 0, 255);
// Kopf
imagearc($img, 100, 100, 200, 200, 0, 360, $white);
// Mund
imagearc($img, 100, 100, 150, 150, 25, 155, $red);
// Augen
imagearc($img, 60, 75, 50, 50, 0, 360, $green);
imagearc($img, 140, 75, 50, 50, 0, 360, $blue);
// Ausgabe im Browser
header("Content-type: image/png");
imagepng($img);
// Speicher freigeben
imagedestroy($img);
?>
Das oben gezeigte Beispiel erzeugt
eine ähnliche Ausgabe wie: