この画像のテキストを回転させて中央に配置するためにすべてが機能しますが、imagecolortransparent 関数によって作成されたテキストの周りに黒い境界線があります。テキストと透明な背景を持つ画像を作成するにはどうすればよいですか? コードは次のとおりです。
header('Content-Type: image/png');
$title = "test text";
$im = imagecreatetruecolor(87, 80);
$white = imagecolorallocate($im, 255, 255, 255);
$black = imagecolorallocate($im, 0, 0, 0);
imagefill($im, 87, 80, $black);
imagecolortransparent($im, $black);
$white = imagecolorallocate($im, 255, 255, 255);
$font = "../fonts/arial.ttf";
$bbox = imagettfbbox(12,-40,"../fonts/arial.ttf", $title);
$width = $bbox[2]-$bbox[0];
$height = ceil(($bbox[6]-$bbox[0])/2);
$pos = ceil((87-$width)/2);
$posx = $pos-$height;
$posy = $pos+$height;
imagettftext($im, 12, -45, $posx, $posy, $white, $font, $title);
imagepng($im);
imagedestroy($im);