将点文件(graphviz)转换为图像时如何设置分辨率?
我尝试过
$ dot -Tpng rel_graph.gv > rel_graph.png
,但生成的图像质量非常低。
I tried
$ dot -Tpng rel_graph.gv > rel_graph.png
but the resulting image has a very low quality.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
使用 dpi 属性。
例子:
Use the dpi attribute.
Example:
使用选项 -Gdpi。
您可以在此处找到更多信息。
Use option -Gdpi.
You can find more information here.
我发现 GraphViz 绘制了漂亮的图形,但分辨率往往相当低,您可以尝试输出到 SVG,然后使用其他一些图像包来适当缩放图像,然后保存到基于像素的格式,如 PNG。这可能会为您提供更好的分辨率,但我个人从未尝试过,我倾向于主要创建 SVG 文件,然后可以使用浏览器查看。
只需将 -T 参数更改为 -Tsvg
点指南中有一些内容 http://www.graphviz.org/pdf/dotguide.pdf graphviz.org/pdf/dotguide.pdf 关于图形的缩放,但不太清楚这如何影响分辨率,您也可以尝试这些设置,看看是否可以改善情况。
I find GraphViz draws nice Graphs but the resolution tends to be reasonably low, you could try outputting to SVG and then using some other image package to scale the image appropriately and then save to a pixel based format like PNG. This might give you better resolution but I've never tried it personally, I tend to mainly just create SVG files I can then view with a browser.
Just change the -T parameter to -Tsvg
There is some stuff in the Dot Guide http://www.graphviz.org/pdf/dotguide.pdf about scaling of Graphs but it's not very clear about how that affects resolution, you could also experiment with those settings and see if that improves things.
我认为抗锯齿取决于驱动程序。例如,我们硬编码
cairo_font_options_set_antialias(选项,CAIRO_ANTIALIAS_GRAY);
但我在其他图形基元中没有看到任何有关显式平滑或抗锯齿的信息,也没有在任何其他驱动程序中看到任何有关抗锯齿或平滑的提及。
I think antialiasing is driver-dependent. For example, we hardcode
cairo_font_options_set_antialias(options,CAIRO_ANTIALIAS_GRAY);
but I don't see anything about explicit smoothing or antialiasing in other graphics primitives or any mention of antialiasing or smoothing in any other drivers.