このコードを使用して、背景が透明なテキストが書き込まれた画像を作成しています。
<?php
// Set the content-type
header('Content-Type: image/gif');
// Create the image
$im = imagecreatetruecolor(400, 150);
// Create some colors
$black = imagecolorallocate($im, 0, 0, 0);
$acolor = imagecolorallocate($im, 153, 204, 153);
imagecolortransparent($im, $black);
// The text to draw
$text = 'Testing...';
// Replace path by your own font path
$font = 'arial.ttf';
// Add the text
imagettftext($im, 50, 0, 10, 100, $acolor, $font, $text);
// Using imagegif()
imagegif($im,"img.gif");
imagedestroy($im);
?>
しかし、img.gif で書かれたテキストには、アルファベット ('e,s,n,g') の境界に不要な色 (黒) が含まれています。どうしたらあの色に仕上がるのでしょうか。 生成された画像は
arial
フォントのダウンロードサイトです