Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is there a way to save the generated GraphViz image to an image file? #13

Closed
amosjyng opened this issue Sep 12, 2013 · 2 comments
Closed

Comments

@amosjyng
Copy link

No description provided.

@vchahun
Copy link
Owner

vchahun commented Sep 12, 2013

Yes, you could use:

with open('/tmp/fst.svg', 'w') as f:
    f.write(t._repr_svg_())

to save the SVG image generated for the ipython notebook.

or if you want another format, just do:

with open('/tmp/fst.dot', 'w') as f:
    f.write(t.draw())

and run graphviz on the resulting dot file:

dot /tmp/fst.dot -Tpng > /tmp/fst.png

@vchahun vchahun closed this as completed Sep 12, 2013
@ghost
Copy link

ghost commented Jan 7, 2021

Use the following linux command for conversion and for the resolution.

dot -Tpng -Gdpi=1024 (graph.gv) OR (graph.dot) > graph.png

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants