Inserting image in a node

All,
sorry if this is stupid beginner’s question…
I have been trying to insert an image in a node using the image attribute with no success. Anything I try gives me the warning:

Warning: “node.svg” was not found as a file or as a shape library member
Warning: No or improper image=“node.svg” for node “0”

And no image is inserted. This happens in any environment I tried (python, Ipython, or directly using the command line commands. I also tried on the Google Colab cloud and also there I get the same error.

This is the code I use (pyGraphViz):

from graphviz import Digraph
G = Digraph(format=‘svg’)
G.node(‘0’,label=“”,image=“node.svg”)
G.render(view=True)

and the dot file:

digraph {
0 [label=“” image=“node.svg”]
}

Thank you for any help you can give me…
marco

PS node.svg can be found here: Dropbox - File Deleted

Marco Buongiorno Nardelli, PhD
University Distinguished Research Professor
University of North Texas
CEMI, Center for Experimental Music and Intermedia
iARTA, Initiative for Advanced Research in Technology and the Arts
ArtSciLab, ATEC @ the University of Texas at Dallas
Associate Fellow, IMéRA - Institut d’Études Avancée d’Aix-Marseille Université

1 Like

My guess is that node.svg is not a legal svg file. What I looked at from dropbox is not an svg file, but many file-sharing systems don’t share svg files “pure” because they can include malware javascript. I’m not sure if dropbox fiddles with svg files or not.
I made my own node.svg & dot was happy to find and insert it.

Hi, thank for your reply! I generate my svg using Adobe Illustrator on my local machine, so in that case it does not depend on dropbox. I have the same problem with all other image formats (jpg, png, etc.).
How did you make your svg? is there a specific svg format I should save the file to?
Thanks!
marco

SOLVED IT! it was a problem with the svg format from Illustrator. I found the right settings and now it works!
Thanks again,
marco

Hello sir,
i am trying to achieve the same in python via pygraphviz, would you please let me know how you attached image to the node of your graph in python. A code snippet would be very helpful.
Thanks