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 any API to convert a gv.Graph object to numpy.ndarray? #49

Closed
BoyuanYan opened this issue Mar 3, 2018 · 1 comment
Closed

Comments

@BoyuanYan
Copy link

I need to generate network topo image and handle it immediately. So, saving a gv.Graph object to png image file and reading it by PIL.Image is wasting time. And could anyone tell me any method to convert a gv.Graph object to numpy.ndarray object in memory but not on hard-disk?

@xflr6
Copy link
Owner

xflr6 commented Mar 3, 2018

If I correctly interpret your use case, I think you might try the .pipe()-method of your Graph object (see docs), probably feeding the return value to the PIL.Image.frombytes constructor (docs).

I think a method (new feature) for directly converting a graphviz.Graph object into a numpy.ndarray (two-dimensional bitmap of raster points, I assume) would be out of scope for the graphviz package.

@xflr6 xflr6 closed this as completed Mar 3, 2018
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