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.
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.
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..)
发布评论
评论(5)
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.
如何应用
imagefilter
的IMG_FILTER_GAUSSIAN_BLUR
、IMG_FILTER_SELECTIVE_BLUR
或IMG_FILTER_SMOOTH
就上线了吗?How about applying
imagefilter
'sIMG_FILTER_GAUSSIAN_BLUR
,IMG_FILTER_SELECTIVE_BLUR
, orIMG_FILTER_SMOOTH
just on the line?您的线条可能已正确抗锯齿,但您还需要对图像进行伽玛校正。我不知道 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.
看起来最简单的解决方案是解压缩 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..)
抱歉,看来我对你投了反对票(或者我改变了?似乎我现在有评论家徽章)
我使用了一些 hack,看起来还不错
http://i42.tinypic.com/72tzes.jpg
http: //i42.tinypic.com/290yidi.png
我只是在主线后面画几条颜色较少的线
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