Hello,
I have this code in a php script, which takes all pixels from a PNG image
and produces a second "image"
with random numbers in HTML format this time. (an example can be found at
http://www.cyprusnews.org/sub/prog2.php).
Instead of getting ALL shades of red from the pallette, I get only 8-9
shades: those corresponding to
values of red with R value 0,51,102,153,204,255.
Anyone can explain that?
Here's the code:
$im = imagecreatefrompng("vac3.png");
$dimx = imagesx($im);
$dimy = imagesy($im);
for ($f=0; $f<$dimy; $f+=5) {
for ($i=0; $i<$dimx; $i+=5) {
$colsat = imagecolorat($im,$i,$f);
$colss = imagecolorsforindex($im,$colsat);
$r = dechex($colss[red]);
$g = dechex($colss[green]);
$b = dechex($colss[blue]);
if ($colss[red] < 16) $r = "0" . $r; // assure that 13 becomes #0D
and
not D
if ($colss[green] < 16) $g = "0" . $g;
if ($colss[blue] < 16) $b = "0" . $b;
$rndn = rand(0,9);
echo "<font color=#".$r.$g.$b.">".$rndn."0";
}
echo "<br>";
}
ImageDestroy($im);
thanks
subbie
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]