GD : Black background with imagecreatetruecolor
| From: | Arnaud | Date: | Thu, 21 Nov 2002 21:22:07 +0000 |
| Subject: | GD : Black background with imagecreatetruecolor | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-125504@lists.php.net to get a copy of this message | ||
Hi everyone,
I'd like to use "imagecreatetruecolor" function in order to "cut and paste"
JPG files on a white background. It seems not to work correctly.
Here is my test scripts :
This one works perfectly :
<?
$im=imagecreate(50,50);
$COULEUR_BLANC=imagecolorallocate($im,255,255,255);
header ("Content-type: image/png");
ImagePNG($im);
imagedestroy($im);
?>
I obtain a white image but using GD 2.x, the "imagecopy" function fails.
This other script doesn't work :
<?
$im=imagecreatetruecolor(50,50);
$COULEUR_BLANC=imagecolorallocate($im,255,255,255);
header ("Content-type: image/png");
ImagePNG($im);
imagedestroy($im);
?>
I'm getting a black image.
My configuration is PHP 4.2.3 with gd2 running on Windows XP (I've also
tested it on my web provider machine - Linux with PHP 4.2.2)
Any help would be great.
Thanks in advance
Arnaud