473,606 Members | 2,115 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

turning off antialiasing in imagettftext() does not work


From: http://www.php.net/manual/en/function.imagettftext.php
"color is the color index. Using the negative of a color index has the
effect of turning off antialiasing."

I'm using a bundled version of GD: 2.0.23 compatible. When using the
function imagettftext() with a negative color to get a aliased text as
stated in the docs the text gets grainy. Not antialised, and not
aliased. Something in between (ugly!). I've tried several fonts.
What could be wrong?

Leif

Jul 17 '05 #1
3 4404

Leif Wessman wrote:
From: http://www.php.net/manual/en/function.imagettftext.php
"color is the color index. Using the negative of a color index has the effect of turning off antialiasing."

I'm using a bundled version of GD: 2.0.23 compatible. When using the
function imagettftext() with a negative color to get a aliased text as stated in the docs the text gets grainy. Not antialised, and not
aliased. Something in between (ugly!). I've tried several fonts.
What could be wrong?

Leif


This is my code. As you can see there is nothing special about it:

<?
header("Content-type: " . image_type_to_m ime_type (IMAGETYPE_PNG) );
$im = imagecreate(400 , 30);
$white = imagecoloralloc ate($im, 255, 255, 255);
$black = imagecoloralloc ate($im, 0, 0, 0);

imagettftext($i m, 10, 0, 10, 20, -$black, "verdanab.t tf", "Testing...
Omega");
imagepng($im);
imagedestroy($i m);
?>

This is the output of the script:

http://www.freewebs.com/leifwessman/test.png
As you can see, the text is grainy.

Jul 17 '05 #2

Leif Wessman wrote:

Leif Wessman wrote:
From: http://www.php.net/manual/en/function.imagettftext.php
"color is the color index. Using the negative of a color index has the
effect of turning off antialiasing."

I'm using a bundled version of GD: 2.0.23 compatible. When using the
function imagettftext() with a negative color to get a aliased text

as
stated in the docs the text gets grainy. Not antialised, and not
aliased. Something in between (ugly!). I've tried several fonts.

http://www.freewebs.com/leifwessman/test.png
As you can see, the text is grainy.


It looks aliased to me... I think it just looks grainy because it's aliased and
tiny. I think if you make it bigger, the aliasing will become apparent.

Shawn
--
Shawn Wilson
sh***@glassgian t.com
http://www.glassgiant.com
Jul 17 '05 #3

Shawn Wilson wrote:
Leif Wessman wrote:

Leif Wessman wrote:
From: http://www.php.net/manual/en/function.imagettftext.php
"color is the color index. Using the negative of a color index has
the
effect of turning off antialiasing."

I'm using a bundled version of GD: 2.0.23 compatible. When using
the function imagettftext() with a negative color to get a aliased
text as
stated in the docs the text gets grainy. Not antialised, and not
aliased. Something in between (ugly!). I've tried several fonts.

http://www.freewebs.com/leifwessman/test.png
As you can see, the text is grainy.


It looks aliased to me... I think it just looks grainy because it's

aliased and tiny. I think if you make it bigger, the aliasing will become apparent.
Shawn
--
Shawn Wilson
sh***@glassgian t.com
http://www.glassgiant.com

I've tried making it bigger. I've tried different fonts. Same result.
It shouldn't look that way... Something is wrong.

Leif

Jul 17 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
9140
by: bof | last post by:
I'm attempting to use ImageTTFText to render text to an image, I can get it to work if I a) specify the full font path b) switch off anti-aliasing c) specify an OpenType font (e.g. arial.ttf) If I specify a TrueType font (e.g. futura.ttf) I get an error message "Warning: imagettftext(): Could not find/open font in c:\filepath"
0
2131
by: John Wellesz | last post by:
Hi, since I've upgraded to php 4.3.4 (before I used 4.1.2) I have a problem with imagettftext(): when executing the line: imagettftext($im, 20, 0, 10, 25, $white, "$script_dir/verdana.ttf", "Test en cours... Oméga: Ω");
1
4239
by: Axier | last post by:
I cannot get the swedish character set on images. What can be wrong? I would very much appreciate help. regards, axier I can supply some code here and a link: http://www.mymobile.nu/services/fontgen/fonttest.php Some people looks like they can get it to work with no effort at all with the same script.
0
1929
by: ljb | last post by:
Using PHP-4.3.11 with GD extension, bundled GD library, and freetype-2.1.9 (with X.org 6.8.1). I can't get the TrueType Font (TTF) bounding box to come out right. Whether using imagettftext() or imagettfbbox(), for some angles of text (like 45 degrees), the box comes back in the wrong place. Sample code below; just change the $font assignment to point to a TTF font file. You should see a text string with a box around it, but my box isn't...
2
2905
by: Gordan | last post by:
Im using imagettftext to write some text on my image. I'm on Win XP and using the plain arial.ttf font that I copied from win dir my typical line would be imagettftext($im, 33, 0, 20, 500, $black, 'arial.ttf', $text); everything is perfect except the tab "\t" sign if I set $text = "something\tsomething" the tab gets displayed but it also displays some rectangle like "this char is in wrong encoding" or something like that. Basically I...
1
10483
by: franscescomoi | last post by:
Hi. On PHP 4.3.10 on Linux I try to: ------ $im = imagecreate(400, 30); $black = imagecolorallocate($im, 0, 0, 0); imagettftext($image, 20, -3, 10, 20, $black, 'Arial.ttf', 'Test'); ------- But I get this error message:
0
1082
by: Turbot | last post by:
Does anyone know how to stop a RichTextBox control from antialiasing the text you enter into it?
3
1664
by: Matt | last post by:
I'm not real sure how the drawing & image fxns work in php, so please bear with me... I'm using a script (logo.php) to draw a simple logo -- basically text with a shaded background. It looks great when I browse it at localhost (a Fedora Core 3 box), but if I use another machine (Gentoo) on the network, it says "The image ...logo.php cannot be displayed, because it contains errors" I can only get (part of) it to show by commenting out:
6
2529
by: monomaniac21 | last post by:
My url is www.aptitudehack.com Hi i cant get an image to display on another server though it does on mine. Here is the code for the page. The problem i think is the imagettftext function particularly the reference to my font file "Verdana". If i use a different function to write text it does so no bother but unfortunately i need this function to work. Here is the error it outputs followed by the code for the page in question:
0
8009
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8432
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8078
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
6753
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
5962
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5456
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
2442
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1548
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1285
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.