# Inserting image in a node

**URL:** <https://forum.graphviz.org/t/inserting-image-in-a-node/523>\
**Category:** Help\
**Created:** [January 27, 2021, 4:56am UTC](https://forum.graphviz.org/t/inserting-image-in-a-node/523 "2021-01-27T04:56:00Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![marcobn](https://sea2.discourse-cdn.com/graphviz/user_avatar/forum.graphviz.org/marcobn/32/392_2.png) [@marcobn](https://forum.graphviz.org/u/marcobn)\
**Post date:** [January 27, 2021, 4:56am UTC](https://forum.graphviz.org/t/inserting-image-in-a-node/523/1 "2021-01-27T04:56:00Z")

</div>

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](https://www.dropbox.com/s/sszo9mqrdvg50yp/node.svg?dl=0)

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é

---

<div class="post-metadata">

**Author:** ![steveroush](https://avatars.discourse-cdn.com/v4/letter/s/a9adbd/32.png) [@steveroush](https://forum.graphviz.org/u/steveroush)\
**Post date:** [January 27, 2021, 6:14am UTC](https://forum.graphviz.org/t/inserting-image-in-a-node/523/2 "2021-01-27T06:14:03Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![marcobn](https://sea2.discourse-cdn.com/graphviz/user_avatar/forum.graphviz.org/marcobn/32/392_2.png) [@marcobn](https://forum.graphviz.org/u/marcobn)\
**Post date:** [January 27, 2021, 3:44pm UTC](https://forum.graphviz.org/t/inserting-image-in-a-node/523/3 "2021-01-27T15:44:24Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![marcobn](https://sea2.discourse-cdn.com/graphviz/user_avatar/forum.graphviz.org/marcobn/32/392_2.png) [@marcobn](https://forum.graphviz.org/u/marcobn)\
**Post date:** [January 27, 2021, 3:50pm UTC](https://forum.graphviz.org/t/inserting-image-in-a-node/523/4 "2021-01-27T15:50:25Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![nalind](https://avatars.discourse-cdn.com/v4/letter/n/a698b9/32.png) [@nalind](https://forum.graphviz.org/u/nalind)\
**Post date:** [January 16, 2023, 8:01pm UTC](https://forum.graphviz.org/t/inserting-image-in-a-node/523/5 "2023-01-16T20:01:42Z")

</div>

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
