|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #30739 Writing on a Black BG
Submitted: 2004-11-10 00:05 UTC Modified: 2004-11-17 18:18 UTC
From: nate at highsocietyfreeride dot com Assigned: pajoye
Status: Closed Package: GD related
PHP Version: 4.3.10-dev OS: apache?
Private report: No CVE-ID:
 [2004-11-10 00:05 UTC] nate at highsocietyfreeride dot com
First off, I'm not sure what verison of PHP our servers use.  My hosting service is

When I use imagettftext to write onto an image, it works fine, unless I allocate the color of 0,0,0.  Even 1,1,1 works just fine.

When I write to a complete black background the text shows up as rectangles, not the actual letters.  The rectangles look like bounding boxes because they take the size of the actual letter its trying to print.

Reproduce code:
	$im_header = imagecreatetruecolor( 440, 83);
	$white = imagecolorallocate($im_header, 255, 255, 255);
	$black = imagecolorallocate($im_header, 0, 0, 0);
	imagecolortransparent($im_header, $black);
	imagettftext($im_header, 32, 0, 0, 42, $white, "fonts/verdana.TTF", "test");


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2004-11-10 09:39 UTC]
Confirmed with 4.3.10-dev, not reproducible with 5.0.x & 5.1.x branch.
 [2004-11-17 18:18 UTC]
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
Thank you for the report, and for helping us make PHP better.


The bug was due to imagefill, it did not set back the alphablending to true. This is somehow required for font rendering with antialiasing.

Btw, with true color images you do not need to fill the background with black, the default is black (0).

a temporary fix is to call imagealphablending(true); after imagefill.

Bug is fixed in cvs.

Thanks for this report,

 [2013-08-28 08:37 UTC]
Automatic comment from SVN on behalf of daverandom
Log: This is due to the removal of Logo GUIDs, instead a new substitute (data URIs and direct embedding of the credits) is used, which means that expose_php has no effect.

Provided by anonymous #30739 (
PHP Copyright © 2001-2015 The PHP Group
All rights reserved.
Last updated: Tue Dec 01 21:01:34 2015 UTC