Image Node documentation

Hello all!

I've got some code that doesnt work and a request.
Here is my code:

digraph g{
imgnode[image="surface.png", label=""];
}

The console returns:
Warning: No such file or directory while opening surface.png
Warning: No or improper image="surface.png" for node "imgnode"

An image called surface that is a png is in the same folder as the graphviz file. I dont understand why it wont load.

As for my request, could someone who understands Graphviz please update the documentation to have an example of how images should work preferably in a way that links to some image already within the package such as the Graphviz icon? Also, enlightening me as to why my code wont work would be much appreciated. The code is literally a copy paste of an example I found on the internet with the file name changed.

Cheers, Jake.

Windows 10 with Graphviz 2.38

The image file may be in the

The image file may be in the same directory as your dot file, but that probably is not your current working directory, which is where the layout program will look for image files given relative pathnames by default. There are lots of ways to fix this:

  1.  Run the layout program in the directory containing the dot file.
  2. Use an absolute path name for the image file in your input.
  3. Set the imagepath attribute in the graph. This will be a list of directories in which the layout program will look for the image file. See http://www.graphviz.org/content/attrs#dimagepath

The last is the preferred approach. One might suggest a feature so that the image path automatically includes the directory containing the dot file as well as the current working directory.

I will take a look at making the documentation better. Thanks.

Recent comments