>From the gd manual at boutell.com: Truecolor images are always filled with black at creation time. There is no concept of a "background" color index.
I suppose you'll have to use a function like imagefill to get your yellow background. -Josh On Tue, 29 Oct 2002, Wouter de Jong wrote: > Hi, > > Could anyone tell why my background colors with > ImageCreateTrueColor() are becoming black ? > > I use the following script: > > <?php > Header("Content-type: image/png"); > $im = @ImageCreateTrueColor(120, 50) > or die ("Cannot Initialize new GD image stream!"); > $background_color = ImageColorAllocate($im,255,255,100); > $text_color = ImageColorAllocate($im,233,14,91); > ImageString($im,1,5,5,"A Simple Text String",$text_color); > ImagePNG($im); > ImageDestroy($im); > ?> > > If I use ImageCreate(), the color becomes yellow as expected. > > This is with GD 2.0.4 (conf-opts: http://s003.widexs.nl/phpinfo.php) > > Any help appreciated :) > > Another question: > > Is it correct that JPEG images are showing up very ugly compared to the > same code with PNG? > > See http://s003.widexs.nl/gd-test-png.php and > http://s003.widexs.nl/gd-test-jpeg.php > > The source is the above code, but with ImageCreate() instead of > ImageCreateTrueColor(), and with jpeg instead of png for the > gd-test-jpeg.php script. > > -- > Met vriendelijke groet/With kind regards, > > Wouter de Jong > System-Administrator > > CABLE & WIRELESS > Delivering the Internet promise(tm) > URL: http://www.widexs.nl > > Email: [EMAIL PROTECTED] > Tel: +31 (0) 23 5698070 > Fax: +31 (0) 23 5698099 > > > >*************************************************************************************** > This message may contain information which is confidential or privileged. > If you are not the intended recipient, please advise the sender immediately > by reply e-mail and delete this message and any attachments without retaining a copy. > >*************************************************************************************** > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php