bobinindia Posted June 13, 2008 Share Posted June 13, 2008 Creating text with imagettftext When the text comes back it isn't very clean. Is there something I can do to keep the edges of the text smooth. I set the imagepng to no compression(0). $mask = imagecreatetruecolor($x,$newy); $tcolour = imagecolorallocate($mask,254,255,255); imagefilledrectangle($mask, 0, 0, $x, $newy, $tcolour); // Or draw other background. imagecolortransparent($mask, $tcolour); $color = rgb2hex2rgb($colour); $one = $color[0]; $two = $color[1]; $three = $color[2]; $txtcol = imagecolorallocate($mask, $one, $two, $three); imagettftext($mask,$fontsize, 0, 0, $y, $txtcol, $font, $txt); //stopcache is a timerelated number. $imurl = "images/transtext/".$stopcache.".png"; imagepng($mask, $imurl, 0); imagedestroy($mask); Quote Link to comment Share on other sites More sharing options...
bobinindia Posted June 13, 2008 Author Share Posted June 13, 2008 Solved it. By making the transparent color one of the RGB values - 1 or +1. The eye can't see it. $color = rgb2hex2rgb($colour); $one = $color[0]; $two = $color[1]; $three = $color[2]; if ($three<255){ $replace = $three +1; } else { $replace = $three - 1; } $tcolour = imagecolorallocate($mask,$one,$two,$replace); 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.