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

Render dot to png generated empty file #113

Open
fengttt opened this issue Feb 28, 2025 · 0 comments
Open

Render dot to png generated empty file #113

fengttt opened this issue Feb 28, 2025 · 0 comments

Comments

@fengttt
Copy link

fengttt commented Feb 28, 2025

I am trying to render a dot file to png. Here is my simple function.

func RenderDot(dot string, fn string) error {
	ctx := context.Background()
	g, err := graphviz.New(ctx)
	if err != nil {
		return err
	}
	defer g.Close()
	graph, err := graphviz.ParseBytes([]byte(dot))
	if err != nil {
		return err
	}

	err = g.RenderFilename(ctx, graph, graphviz.PNG, fn)
	return err
}

When trying to render "digraph G {Hello->World}", there is no error, but the generated png file is 0 byte. Any hint that what I did wrong?

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

1 participant