ImageCreateTrueColor background always gets black and JPEG vs. PNG color difference

From: Date: Tue, 29 Oct 2002 12:38:32 +0000
Subject: ImageCreateTrueColor background always gets black and JPEG vs. PNG color difference
Groups: php.general 
Request: Send a blank email to php-general+get-121842@lists.php.net to get a copy of this message
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: Wouter.deJong@cw.com 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. ***************************************************************************************

« previous php.general (#121842) next »