Re: White background with imagecreatetruecolor()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux