|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #7769 antialias does not work properly in imagettftext
Submitted: 2000-11-12 16:08 UTC Modified: 2000-11-13 07:35 UTC
From: defiant at telnet dot hu Assigned: markonen (profile)
Status: Closed Package: GD related
PHP Version: 4.0.3pl1 OS: Debian Lin "woody"
Private report: No CVE-ID: None
 [2000-11-12 16:08 UTC] defiant at telnet dot hu
Hi there!

The following script should produce a BLACK text over a red rectangle on a white background. It almost does that, except that the color of the text is GRAY.

header ("Content-type: image/png");
$im = ImageCreate (250, 40);
$background_color = ImageColorAllocate ($im, 255, 255, 255);
$rect_color = ImageColorAllocate ($im, 255, 0, 0);
$text_color = ImageColorAllocate ($im, 0, 0, 0);
ImageFill($im, 0, 0, $background_color);
ImageFilledRectangle($im, 60, 5, 100, 35, $rect_color);
ImageTTFText ($im, 20, 0, 10, 20, $text_color, "/cda/ttf/ARIAL.TTF", "Testing... ");
ImagePng ($im); 

If I turned off the antialiasing with

ImageTTFText ($im, 20, 0, 10, 20, 1*$text_color, "/cda/ttf/ARIAL.TTF", "Testing... ");

then the text color is black again (negative color index).

I do not know if it is a problem with GD or Freetype or PHP or the Debian package. A script like this worked for me fine before, but it does not right now.

Debian packages installed:



Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2000-11-12 20:20 UTC]
You compiled with the 
--enable-freetype-4bit-antialias-hack configure option, 
right? That option is bogus, and has been removed 
from 4.0.4. You should be able to use PHP with 
freetype2 anyway, but only with 2-bit (4-shade) 
 [2000-11-13 07:35 UTC]

 [2002-06-25 14:51 UTC] nordmann at orgatech dot de
i removed the "--enable-freetype-4bit-antialias-hack" option from the build-script in Debian 2.2's php4-package.

Black Text with ImageTTFText gets gray when used with

i discovered that Debian's "freetype2"-package is really freetype1. the freetype2 (called freetype6) is only available with the upcoming Debian 3.0.

i'll try to downport freetype 2 to Debian 2.2
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Fri Dec 01 21:01:27 2023 UTC