1.91:1 link-preview cards from any image, on a Cloudflare Worker
Files
README.md

cards #

a Cloudflare Worker that turns an image into a 1.91:1 link-preview card, so a square glyph or a tall gif unfurls whole instead of cropped. animated gifs are letterboxed with their frames and timing kept, re-encoded with gifuct-js and gifenc. anything else is drawn into a rounded dark tile with the Images binding.

live: cards.waow.tech, used by status

use #

curl -o card.png "https://cards.waow.tech/card?src=https%3A%2F%2Fall-the.bufo.zone%2Fbufo-science.png"

src must be on an origin in ALLOWED_ORIGINS; an app adds its image hosts there. when a card can't be made, the answer is a redirect to src. cards are cached for a day.

develop #

npm install
npm test                               # the gif path, under node
npm run check                          # types
npm run dev                            # local Worker; the Images binding runs remotely
npm run assets                         # redraw the tile layers after a layout change
npm run deploy

license #

MIT