3 ms·
I used puppeteer (headless chrome) to generate image previews. Can use the Canvas API and/or WebGL1 and WebGL2. Can also auto-add titles etc... You could even
by asiachick 5y ago
I used puppeteer (headless chrome) to generate image previews. Can use the Canvas API and/or WebGL1 and WebGL2. Can also auto-add titles etc... You could even overlay HTML styled with CSS (vs drawing text with the Canvas API) and use the Puppeteer API to take a screenshot instead of using the canvas API to capture the canvas.
- devmunchies 5y agodon't need all of headless chrome to use the canvas. can just use node-canvas. https://github.com/Automattic/node-canvas https://github.com/Automattic/node-canvas
- asiachick 5y agonode-canvas will not give you the features mentioned in my comment
- rognjen 5y agoI did a similar thing using the IMGKit gem https://github.com/csquared/IMGKit https://github.com/csquared/IMGKit that uses wkhtmltoimage to generate a PNG from HTML. I believe you could use wkhtmltoimage directly and skip Puppeteer.