How do I set the resolution when converting dot files (graphviz) to images?

有些话、适合烂在心里 提交于 2019-11-27 10:06:51

问题


I tried

$ dot -Tpng rel_graph.gv > rel_graph.png

but the resulting image has a very low quality.


回答1:


Use the dpi attribute.

Example:

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



回答2:


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

Use option -Gdpi.

You can find more information here.




回答3:


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.



来源:https://stackoverflow.com/questions/1286813/how-do-i-set-the-resolution-when-converting-dot-files-graphviz-to-images

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!