Displaying an image inside a node

Hello,

I have tried different ways of displaying a png file inside a node with no success

imgnode[label="", image="user.png"]
imgnode[label="", imagepath=".\", image="user.png"]
imgnode[label="", imagepath="./", image="user.png"]
imgnode[shape=plaintext, label=<<TABLE CELLSPACING="2" CELLPADDING="2" BORDER="0"><TR><TD><IMG SRC="user.png" /></TD></TR></TABLE>>]

The image is in the same folder, on Windows, and using dot - graphviz version 8.0.5 (20230430.1635)

Any help is appreciated.

Thank you.

Huh! Below is a file that works for me on Windows. A slightly older version, but I doubt that is the problem (famous last words) (dot - graphviz version 7.0.6 (20230106.0513)).

  • please show your full command line
  • also show your error messages
  • finally are you sure that “user.png” exists (maybe not a png?) and is in the same directory as the input & is the “current” directory?
digraph G {

 node [shape=none label=""]
 node [imagescale=true]
 n1  [ image="image_dir/noLeft.png" ]
 n2  [ image="image_dir/cow.png" ]

 n4  [ image="image_dir/noLeft.png" ]
 n5  [ shape=triangle image="image_dir/warning.png"]
 n6  [ shape=circle image="image_dir/noLeft.png" ]

 n1 -> n2
 n2-> n4 -> n5 -> n6

 node [imagescale=true]
 J1  [ image="noLeft.png" ]
 J2  [ image="cow.png" ]

 J4  [ image="noLeft.png" ]
 J5  [ shape=triangle image="warning.png"]
 J6  [ shape=circle imagepath="./" image="noLeft.png" ]
// FAILS on WIndows  J6  [ shape=circle imagepath=".\" image="noLeft.png" ] 

 J1 -> J2
 J2-> J4 -> J5 -> J6

{rank=source
imgnode[shape=plaintext, label=<
<TABLE COLOR="red" CELLSPACING="2" CELLPADDING="2" BORDER="3"><TR><TD>Cow in a box!</TD></TR>
<TR><TD><IMG SRC="cow.png" /></TD></TR>
</TABLE>>]
}
}

Giving: