February 26th, 2004, 11:01 PM
|
#1 (permalink)
|
| Ultimate Member
Join Date: Nov 2001 Location: Winston-Salem, NC
Posts: 1,440
| Quote:
<?
$im = ImageCreate(100,100);
for ($y = 0; $y <= 100; $y++) {
for ($x = 0; $x <= 100; $x++) {
$c1 = rand(1, 255);
$c2 = rand(1, 255);
$c3 = rand(1, 255);
$col = ImageColorAllocate($im, $c1, $c2, $c3);
ImageSetPixel ($im, $x, $y, $col);
}
}
ImagePNG ($im);
?>
| its supposed to draw a 100x100 image and fill it with each pixel being a different, randomly generated color. but when i run it it gives you this the first few lines seem to be working but the rest is all the same color. this code is very simple and i can not for the life of me figure out why it isnt working. its nothing important, i was just screwing around, but i would like to know what im doing wrong. anybody see the problem?
thanks!
EDIT: i checked and it is only coloring 252 of the pixels and then leaving the rest the same color if that helps any...
__________________
Visit http://duroo.org
Last edited by cracked : February 27th, 2004 at 04:29 AM.
|
| |