Ik heb het volgende script:
| //nieuwe afbeelding
| $im = imagecreatefrompng("kaart.png");
| //kaart.png is een lege afbeelding
| $rood = imagecolorallocate($im, 255, 0, 0);
| //eerste aanroep imagecolorallocate stelt achtergrondkleur in
| $blauw = imagecolorallocate($im, 0, 0, 255);
|
| //teken een 'maantje'
| imageline($im, 150, 150 - 14, 150, 150 + 16, $blauw);
| imagearc($im, 150, 150, 16, 16, 0, 360, $blauw);
|
| //om deze regel gaat het, zie onder
| xxxxx
|
| //verzend de afbeelding
| imagepng($im);
| imagedestroy($im);
Als ik inkleur met
imagefilltoborder($im, 152, 152, $blauw, $blauw)
of
imagefilltoborder($im, 152, 152, $blauw, imagecolorallocate($im, 0, 0, 255))
op de plaats van xxxxx is er geen probleem: het maantje wordt keurig
ingekleurd.
Gebruik ik echter
imagefilltoborder($im, 152, 152, imagecolorallocate($im, 0, 0, 255),
$blauw);
of
imagefilltoborder($im, 152, 152, imagecolorallocate($im, 0, 0, 255),
imagecolorallocate($im, 0, 0, 255));
, dan wordt niet alleen het maantje, maar de hele afbeelding ingekleurd.
Wat doe ik fout?
Ik gebruik PHP 4.1.2 zonder GD.

Likes:
![[PHP] Probleem met imagecolorallocate()](https://www.webhostingtalk.nl/images/WHT_rd/misc/dT.png)
Quote