64

I tried

$ dot -Tpng rel_graph.gv > rel_graph.png

but the resulting image has a very low quality.

RobV
  • 28,022
  • 11
  • 77
  • 119
Alexandru
  • 25,070
  • 18
  • 69
  • 78

4 Answers4

104

Use the dpi attribute.

Example:

graph G { 
  graph [ dpi = 300 ]; 
  /* The rest of your graph here. */ 
}
MarcP
  • 1,057
  • 1
  • 7
  • 3
60

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

Use option -Gdpi.

You can find more information here.

DarenW
  • 16,549
  • 7
  • 63
  • 102
x2yline
  • 1,009
  • 9
  • 5
  • 1
    `dot -Tpng -Gdpi=300 foo.gv -o foo110percent.png` Note: You can change the output format by varying the extension of the filename specified with `-o` see: http://www.graphviz.org/doc/info/output.html – Michael James Kali Galarnyk Sep 29 '18 at 19:34
12

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.

RobV
  • 28,022
  • 11
  • 77
  • 119
  • 1
    Saving the SVG data to a `*.png` file seems like a *bad* idea to me… – MvG Jul 07 '15 at 20:59
  • @MvG Dumb typo on my part, think I copy pasted this from the OP question and didn't do a full `png` to `svg` change – RobV Jul 08 '15 at 09:42
0

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.