Skip to content

Instantly share code, notes, and snippets.

@marshmallowrobot
marshmallowrobot / generateImage.js
Created January 16, 2023 18:44
Programmatically generate an image with custom text using a headless browser to screenshot an HTML page
const { join } = require('node:path');
const { writeFileSync } = require('node:fs');
const puppeteer = require('puppeteer');
const imageHtmlHead = () => {
return `
<head>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Source+Serif+Pro&family=PT+Sans&display=swap" rel="stylesheet">
@marshmallowrobot
marshmallowrobot / panda-face.png
Last active January 20, 2023 19:32
Cute CSS only panda face
panda-face.png