将点文件(graphviz)转换为图像时如何设置分辨率?

发布于 2024-08-02 11:25:25 字数 103 浏览 3 评论 0原文

我尝试过

$ 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 技术交流群。

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

发布评论

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

评论(4

梦一生花开无言 2024-08-09 11:25:25

使用 dpi 属性。

例子:

graph G { 
  graph [ dpi = 300 ]; 
  /* The rest of your graph here. */ 
}

Use the dpi attribute.

Example:

graph G { 
  graph [ dpi = 300 ]; 
  /* The rest of your graph here. */ 
}
后eg是否自 2024-08-09 11:25:25

点-Tpng -Gdpi=300 foo.gv > foo110percent.png

使用选项 -Gdpi。

您可以在此处找到更多信息。

dot -Tpng -Gdpi=300 foo.gv > foo110percent.png

Use option -Gdpi.

You can find more information here.

煮茶煮酒煮时光 2024-08-09 11:25:25

我发现 GraphViz 绘制了漂亮的图形,但分辨率往往相当低,您可以尝试输出到 SVG,然后使用其他一些图像包来适当缩放图像,然后保存到基于像素的格式,如 PNG。这可能会为您提供更好的分辨率,但我个人从未尝试过,我倾向于主要创建 SVG 文件,然后可以使用浏览器查看。

只需将 -T 参数更改为 -Tsvg

dot -Tsvg rel_graph.gv > rel_graph.svg

点指南中有一些内容 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

dot -Tsvg rel_graph.gv > rel_graph.svg

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.

咆哮 2024-08-09 11:25:25

我认为抗锯齿取决于驱动程序。例如,我们硬编码
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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文