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. Link to comment https://forums.phpfreaks.com/topic/161044-anti-aliased-text-gd-lib/ 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); Link to comment https://forums.phpfreaks.com/topic/161044-anti-aliased-text-gd-lib/#findComment-849946 Share on other sites More sharing options...
liamthebof Posted June 5, 2009 Author Share Posted June 5, 2009 Well, that worked. Ta very much! Link to comment https://forums.phpfreaks.com/topic/161044-anti-aliased-text-gd-lib/#findComment-849952 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.