I am attempting to use an image as a node in Graphviz. I am using the npm grapghviz project to do this. However, despite numerous tutorials stating that you can do it via the menthods I have outlined below, the .output function just throws an error, with simply the number 1
and no message.
I have attempted the following:
const imagePath = path.join(__dirname, "myImage.png");
g.addNode(node.Name, {
shape: "record",
label: `<f0> | <img src="${myImage}" width="100" height="100"/> | <f1>`, // Image in the record node
style: "filled",
fillcolor: "#FF5733", // Background color
color: "#C70039", // Border color
penwidth: 2 // Border width
})
Using html like label with a table
g.addNode(node.Name, {
label: `<TABLE CELLSPACING="2" CELLPADDING="2" BORDER="0"><TR><TD><IMG SRC="${imagePath}"/></TD></TR></TABLE>>`,
shape: "plaintext",
});
This works, but looks wonky without a table. Long text makes the node HUGE and the image small.
g.addNode(node.Name, {
label: "A Service",
shape: "square",
image: imagePath
});
Essentially, i’m trying to make nodes that look something like this.. but can’t do it as it always throws Error 1 when outputting to either png or svg.