3 ms·
How do you create images without a headless browser?
by solopov 6y ago
How do you create images without a headless browser?
- vermilingua 6y agoPoe’s Law hard at work here.
- dwwoelfel 6y agoThere are lots of different approaches you could take. For sourcecodeshots, I run it through VSCode's tokenizer (https://github.com/microsoft/vscode-textmate https://github.com/microsoft/vscode-textmate) and then use node-canvas to generate the image one line at a time. It's a very imperative process and fairly slow on a cpu, but the nice thing is that I can run the same code in the browser to speed up development. The Rust project, https://github.com/Aloxaf/silicon https://github.com/Aloxaf/silicon, mentioned in another part of the comments is probably faster, but I didn't find it when I was searching for a solution.