PHP GD 更强的抗锯齿功能

发布于 2024-10-03 01:45:00 字数 1431 浏览 0 评论 0原文

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

梦在夏天 2024-10-10 01:45:00

GD 有很多限制,也有很多尴尬的解决方法。我建议使用 ImageMagick 来获得更好的绘图工具,而不会有麻烦。

There are a number of limitations with GD and just as many awkward workarounds. I'd suggest using ImageMagick instead to get better drawing tools without the trouble.

满天都是小星星 2024-10-10 01:45:00

如何应用 imagefilterIMG_FILTER_GAUSSIAN_BLURIMG_FILTER_SELECTIVE_BLURIMG_FILTER_SMOOTH 就上线了吗?

How about applying imagefilter's IMG_FILTER_GAUSSIAN_BLUR, IMG_FILTER_SELECTIVE_BLUR, or IMG_FILTER_SMOOTH just on the line?

鸠魁 2024-10-10 01:45:00

您的线条可能已正确抗锯齿,但您还需要对图像进行伽玛校正。我不知道 GD 是否能让您轻松做到这一点,但我已经在自己的线条渲染代码中看到了效果,并且适当的伽玛值取决于您使用的显示器。

It's possibly the case that your line is antialiased correctly, but that you also need to gamma correct the image. I don't know if GD makes that easy for you, but I've seen the effect in my own line rendering code, and the appropriate gamma value is dependent on the monitor you're using.

孤蝉 2024-10-10 01:45:00

看起来最简单的解决方案是解压缩 JPGraph (http://jpgraph.net),并使用图表类 -这些线条的抗锯齿效果令人惊讶,我敢说,非常漂亮!

(在 CentOS 服务器上设置 ImageMagick 很痛苦 - 上述放大和缩小的方法似乎并不能改善抗锯齿效果。)

It looks like the simplest solution is to unzip JPGraph (http://jpgraph.net), and use the chart classes -- the lines come out amazingly anti-aliased, and dare I say, pretty!

(ImageMagick is a pain to set up on CentOS servers - the above methods of blowing up and reducing does not seem to improve antialiasing..)

凉风有信 2024-10-10 01:45:00

抱歉,看来我对你投了反对票(或者我改变了?似乎我现在有评论家徽章)

我使用了一些 hack,看起来还不错

http://i42.tinypic.com/72tzes.jpg

http: //i42.tinypic.com/290yidi.png

我只是在主线后面画几条颜色较少的线

$arColor = imagecolorsforindex($im, $color);
$AAcolor = imagecolorallocatealpha($im, $arColor['red'], $arColor['green'], $arColor['blue'], 112);

imageline($im,round($prevX+1),round($prevY),round($x),round($y+1),$AAcolor);
imageline($im,round($prevX),round($prevY-1),round($x+1),round($y),$AAcolor);
imageline($im,round($prevX-1),round($prevY),round($x),round($y-1),$AAcolor);
imageline($im,round($prevX),round($prevY+1),round($x-1),round($y),$AAcolor);
imageline($im,round($prevX),round($prevY),round($x),round($y),$color);

sorry, seems I downvoted on you(or I changed that? seems I have Critic badge now)

I used some hack, and it looks not so bad

http://i42.tinypic.com/72tzes.jpg

http://i42.tinypic.com/290yidi.png

i just draw few lines with less color behind main line

$arColor = imagecolorsforindex($im, $color);
$AAcolor = imagecolorallocatealpha($im, $arColor['red'], $arColor['green'], $arColor['blue'], 112);

imageline($im,round($prevX+1),round($prevY),round($x),round($y+1),$AAcolor);
imageline($im,round($prevX),round($prevY-1),round($x+1),round($y),$AAcolor);
imageline($im,round($prevX-1),round($prevY),round($x),round($y-1),$AAcolor);
imageline($im,round($prevX),round($prevY+1),round($x-1),round($y),$AAcolor);
imageline($im,round($prevX),round($prevY),round($x),round($y),$color);
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文