如何在图片中制作文字?
我没有得到消除锯齿的文字:
如何制作与第一张图片相同的平滑效果?
我的代码:
$body = 'Company Name';
$pointsize = 10*1.4; //PT to pointsize
$fill = '000000';
$width = 170;
$canvas = new Imagick();
$draw = new ImagickDraw();
$color = new ImagickPixel($fill);
$draw->setFont('fonts/Arial/Arial.ttf');
$draw->setFontSize($pointsize);
$draw->setFillColor($color);
$draw->setStrokeAntialias(true);
$draw->setTextAntialias(true);
$data = $canvas->queryFontMetrics($draw, $body);
$draw->annotation(0, $data['ascender'], $body);
$draw->annotation(0, $data['ascender'], $body);
$canvas->newImage($width, $data['textHeight'], 'none');
$canvas->drawImage($draw);
$canvas->setImageFormat('png');
header('Content-Type: image/png');
echo $canvas->getImageBlob();