wavedrom / cli

CLI for WaveDrom
https://wavedrom.com
MIT License
61 stars 12 forks source link

Can't export logic circuit diagram as PNG #26

Open jochemarends opened 7 months ago

jochemarends commented 7 months ago

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.