PHP ImageMagick:如何对一行进行抗锯齿

问题描述 投票:1回答:1

我遇到线锯齿边缘问题(见白线):

enter image description here

如果我减少行程(从10减少到4),那就没关系,但线条不够明显(我需要更粗的线条):

enter image description here

我设置了$canvas->setStrokeAntialias(true);,但它没有帮助。如果我提高图像分辨率,那么我需要做出更大的笔划,最后结果是一样的。我怎样才能获得一个很好的抗锯齿线,它也很厚?

这是我的代码:

$canvas = new \ImagickDraw();
$canvas->setStrokeColor($stroke_color);
$canvas->setFillColor($fill_color);
$canvas->setStrokeWidth($stroke_width);
$canvas->setStrokeAntialias(true);

$canvas->line(....);
$canvas->line(....);
$canvas->line(....);
...

编辑:我也尝试过this answer +减少行程,但结果是一样的。

php imagemagick imagick
1个回答
2
投票

根据emcconville的评论,我能够通过使用折线()绘制线而不是许多line()调用来解决这个问题。

enter image description here

© www.soinside.com 2019 - 2024. All rights reserved.