Re: White background with imagecreatetruecolor()

From: Date: Sun, 23 Oct 2005 04:21:42 +0000
Subject: Re: White background with imagecreatetruecolor()
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-224501@lists.php.net to get a copy of this message
On Tue, October 18, 2005 2:21 pm, John Nichel wrote: > I'm diving into the gd functions for the first time, and I'm having a > problem creating a white background for an image when using > imagecreatetruecolor(). The manual says that this function will > create > a _black_ image, but looking at imagecolorallocate() it says that the > first call to this function fills the background color, and they have > examples like this... > > $im = imagecreatetruecolor('example.jpg'); > // sets background to red > $background = imagecolorallocate($im, 255, 0, 0); > And that creates the image with the right sizes and positions, but the > background is black. Is there something wrong in my code, or is the > manual wrong on the imagecolorallocate() function? TIA. I believe the automatic filling in of the background color may have been only in GD 1.0 or something... I'm not sure I ever saw it work. On the plus side, it's easy to fill in the background: imagefilledrectangle($image, 0, 0, $width - 1, $height - 1, $background); -- Like Music? http://l-i-e.com/artists.htm

« previous php.general (#224501) next »