note 13848 deleted from function.imagecolorallocate by jimw

From: Date: Sat, 08 Dec 2001 19:52:15 +0000
Subject: note 13848 deleted from function.imagecolorallocate by jimw
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-22141@lists.php.net to get a copy of this message
It would seem that with the nifty new TrueColor functions, the behaviour of "first color allocated becomes the background color" goes away, at least on 4.0.6 with gd 2.0.1. I imagine this is because gd sets the pixels of a newly-created image to 0 (with memset() or similar). For indexed colors, the first color allocated will be 0, and set the background color. For Truecolor images, this is pure black. As advised above, paint in your background explicitly. I use imageFilledRectangle($img, 0, 0, $xs, $ys, $col), which is faster than imageFill(), 136ms rather than 398ms on my system.

« previous php.notes (#22141) next »