palette limited to 256 colors with ImageColorAllocate()?
| From: | Giuseppe D'Ambrosio | Date: | Thu, 08 Mar 2001 12:28:19 +0000 |
| Subject: | palette limited to 256 colors with ImageColorAllocate()? | ||
| Groups: | php.windows | ||
| Request: | Send a blank email to php-windows+get-5872@lists.php.net to get a copy of this message | ||
I thought this script would create a 256*256 pixel image, each one of a
random color:
______________________________
<?php
dl("php_gd.dll");
$im1 = imagecreate (257,257);
for ($i=0; $i<=256; $i++) {
for ($j=0; $j<=256; $j++) {
$color = ImageColorAllocate ($im1, rand(0,255), rand(0,255),
rand(0,255) ) ;
imageline ($im1, $i,$j, $i+1, $j+1 , $color);
}
}
$filename= "c:\\temp\\prova.jpg";
ImageJPEG ( $im1, $filename , 97);
imagedestroy ($im1);
echo "<img src='$filename'>";
?>
______________________________
but it seems you can't allocate more than 256 colors (though you get no
errors)..
could anybody try it on a linux box?
is this a bug or it's the normal behaviour?
thanks for any help,
bye,
Giuse
http://boltthrower.webhop.org