cli icon indicating copy to clipboard operation
cli copied to clipboard

Can't export logic circuit diagram as PNG

Open jochemarends opened this issue 1 year ago • 0 comments

When trying to convert the following JSON file as PNG using wavedrom-cli -i test.json -p test.png I get the errors I've pasted below:

{ assign:[
  ["out",
    ["|",
      ["&", ["~", "a"], "b"],
      ["&", ["~", "b"], "a"]
    ]
  ]
]}
/usr/local/lib/node_modules/wavedrom-cli/node_modules/svg2img/index.js:64
            imgBuffer = pngData.asPng();
                                ^

TypeError: Cannot read properties of undefined (reading 'asPng')
    at /usr/local/lib/node_modules/wavedrom-cli/node_modules/svg2img/index.js:64:33
    at loadSVGContent (/usr/local/lib/node_modules/wavedrom-cli/node_modules/svg2img/index.js:75:9)
    at svg2img (/usr/local/lib/node_modules/wavedrom-cli/node_modules/svg2img/index.js:24:5)
    at /usr/local/lib/node_modules/wavedrom-cli/wavedrom-cli.js:47:7
    at /usr/local/lib/node_modules/wavedrom-cli/node_modules/graceful-fs/graceful-fs.js:123:16
    at FSReqCallback.readFileAfterClose [as oncomplete] (node:internal/fs/read/context:68:3)

I've tested on both WSL and Windows using version 3.1.1 of wavedrom-cli. On WSL I've tested with the versions 12, 19, and 20 of node. On Windows I've only tested using version 20 of node. When exporting as SVG everything works fine.

jochemarends avatar Feb 06 '24 21:02 jochemarends