4

despite using the most simple boilerplate I can find, I can't seem to get graphviz to render a png image onto a node

Some may consider this a duplicate of How do I get DOT to display an image for a node? however this is the question I was following to get to this point and it STILL doesn't work

I've tried rendering already in several programs including vscode's preview extension, the dot -Tpng graph.png chickens2.dot -v command line method, and GVEdit and none of them correctly render the image into the node

here is my code

digraph graph1 {
    node [shape=record];
    white [image="dye_powder_white.png", label=""];
}

and the folder structure

Chickens/
   |chickens2.dot
   |dye_powder_white.png

I wanted it to simply show the icon inside of the node, but it just renders a blank node.

here is the output from dot.exe:

>dot -Tpng -o graph.png chickens2.dot -v
dot - graphviz version 2.38.0 (20140413.2041)
Using render: cairo:cairo
Using device: png:cairo:cairo
libdir = "C:\Program Files (x86)\Graphviz2.38\bin"
Activated plugin library: gvplugin_dot_layout.dll
Using layout: dot:dot_layout
The plugin configuration file:
        C:\Program Files (x86)\Graphviz2.38\bin\config6
                was successfully loaded.
    render      :  cairo dot fig gd gdiplus map pic pov ps svg tk vml vrml xdot
    layout      :  circo dot fdp neato nop nop1 nop2 osage patchwork sfdp twopi
    textlayout  :  textlayout
    device      :  bmp canon cmap cmapx cmapx_np dot emf emfplus eps fig gd gd2 gif gv imap imap_np ismap jpe jpeg jpg metafile pdf pic plain plain-ext png pov ps ps2 svg svgz tif tiff tk vml vmlz vrml wbmp xdot xdot1.2 xdot1.4
    loadimage   :  (lib) bmp eps gd gd2 gif jpe jpeg jpg png ps svg
pack info:
  mode   undefined
  size   0
  flags  0
  margin 8
pack info:
  mode   node
  size   0
  flags  0
fontname: "Times-Roman" resolved to: (ps:pango  Times New Roman, ) (PangoCairoWin32Font) "Times New Roman, 13.9990234375"
network simplex:  1 nodes 0 edges maxiter=2147483647 balance=1
network simplex: 1 nodes 0 edges 0 iter 0.00 sec
Maxrank = 0, minrank = 0
mincross: pass 0 iter 0 trying 0 cur_cross 0 best_cross 0
mincross graph1: 0 crossings, 0.00 secs.
network simplex:  1 nodes 0 edges maxiter=2147483647 balance=2
network simplex: 1 nodes 0 edges 0 iter 0.00 sec
routesplines: 0 edges, 0 boxes 0.00 sec
Using render: cairo:cairo
Using device: png:cairo:cairo
dot: allocating a 19K cairo image surface (83 x 60 pixels)
gvRenderJobs graph1: 0.00 secs.

here is the exact png image I'm trying to embed just in case it's incompatible with graphviz and I don't realize: https://mega.nz/#!M8EHEITJ!Mm489BA4sd5JLoeWlY7BM-YCIkHeAni96d-e1IY4UAQ

and finally, the resulting image which is the same in every method I've tried:

https://i.stack.imgur.com/3L6by.png

some things I'm considering:

  • is there some kind of configuration I'm not seeing which disables images by default?

  • do I have some kind of outdated version? (literally downloaded the stable this morning to try it out so I doubt it)

  • am I simply doing something wrong?

  • are graphviz images incompatible with windows 10?

  • am I missing a prerequisite library?

  • is my png image incompatible with graphviz somehow?

I've been trying this for an hour or so now and none of my attempts seem to be changing anything. what is the correct way to get graphviz to render an image onto a node?

MFriend
  • 51
  • 4

1 Answers1

1

Old question, but I also couldn't figure this out. The attribute image doesn't seem to work as expected, and the manpage doesn't help, nor do the docs. Posting what worked for me for others who come across this question.

This answered it for me, from 2011. For example, in some image.gv file:

digraph {
    ratio="fill";
    size="10,10!";
    margin="0,0";

    node [shape=plain];
    root [label=<<TABLE border="0"><TR><TD><IMG SRC="image.png"/></TD></TR>
                                   <TR><TD>text under</TD></TR></TABLE>>];
}
Jxek
  • 502
  • 1
  • 4
  • 13