liamthebof Posted June 5, 2009 Share Posted June 5, 2009 Hello PHPF, I am having a problem with GDlib ini PHP. When using imagettftext(), I cannot seem to create crisp text, a form of smoothing/aliasing seems to be enabled. I have negated the color index, but the output is still too blurred to be useful for me in creating a crisp text. Anyone know how to make a work around to this? <?php $string = "A tester"; $width = 350; $height = 19; $img_handle = imageCreate($width,$height); $bg_col = ImageColorAllocate($img_handle, 200,10,10); $textcol = ImageColorAllocate($img_handle, 1, 1, 1); $size = 10; $font = "/visitor2.ttf"; $string_dim = imagettfbbox($size, 0, $font, $string); $x = ($width / 2) - (($string_dim[4] - $string_dim[6]) / 2); $y = 12; Imagettftext($img_handle, $size, 0, $x, $y, -$textcol, $font, $string); header('Content-type: image/jpg'); Imagejpeg($img_handle, "", 100); ?> This is the php output: And here is the expected, anti-aliasing free image: Thanks. Quote Link to comment Share on other sites More sharing options...
kobmat Posted June 5, 2009 Share Posted June 5, 2009 Have you tried to use Imagepng($img_handle); instead of Imagejpeg($img_handle, "", 100); Quote Link to comment Share on other sites More sharing options...
liamthebof Posted June 5, 2009 Author Share Posted June 5, 2009 Well, that worked. Ta very much! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.