Any ideas or help?
Here's the code, and a test page, if you want:
<? header ("Content-type: image/png"); function rgbclr($from, $from2, $var) { if($from != '' && $from2 != '') { $average = $from + $from2 / 2; return mt_rand($average - $var, $average + $var); } elseif($from != '') { return mt_rand($from - $var, $from + $var); } elseif($from2 != '') { return mt_rand($from2 - $var, $from2 + $var); } } $diff = 2; $im = imagecreatetruecolor($_GET['w'], $_GET['h']); for($y = 0; $y < $_GET['h']; $y++) { for($x = 0; $x < $_GET['w']; $x++) { if($y == 0 && $x == 0) { $r[$y][$x] = mt_rand(0, 255); $g[$y][$x] = mt_rand(0, 255); $b[$y][$x] = mt_rand(0, 255); $color = imagecolorallocate($im, $r[$y][$x], $g[$y][$x], $b[$y][$x]); imagesetpixel($im, $x, $y, $color); } elseif($y == 0) { $r[$y][$x] = rgbclr($r[$y][$x-1], '', $diff); $g[$y][$x] = rgbclr($g[$y][$x-1], '', $diff); $b[$y][$x] = rgbclr($b[$y][$x-1], '', $diff); $color = imagecolorallocate($im, $r[$y][$x], $g[$y][$x], $b[$y][$x]); imagesetpixel($im, $x, $y, $color); } elseif($x == 0) { $r[$y][$x] = rgbclr('', $r[$y-1][$x], $diff); $g[$y][$x] = rgbclr('', $g[$y-1][$x], $diff); $b[$y][$x] = rgbclr('', $b[$y-1][$x], $diff); $color = imagecolorallocate($im, $r[$y][$x], $g[$y][$x], $b[$y][$x]); imagesetpixel($im, $x, $y, $color); } else { $r[$y][$x] = rgbclr($r[$y][$x-1], $r[$y-1][$x], $diff); $g[$y][$x] = rgbclr($g[$y][$x-1], $g[$y-1][$x], $diff); $b[$y][$x] = rgbclr($b[$y][$x-1], $b[$y-1][$x], $diff); $color = imagecolorallocate($im, $r[$y][$x], $g[$y][$x], $b[$y][$x]); imagesetpixel($im, $x, $y, $color); } } } imagepng($im); imagedestroy($im);?>
http://d2kstudios.co.../...p?w=64&h=64
Edit: Heheh, that was happening because I didn't put brackets around $from + $from2 Anyways, now it still has some really weird results, like large chunks suddenly changing to a different colour...
Edited by DeathRay2K, 01 August 2006 - 10:12 PM.