JavaScript · Command-line tool, Library · Apache-2.0

share-cards

Renders one HTML design as an image at every size social sites ask for, from link previews to YouTube channel art, keeping text inside each safe area.

View on GitHub

Setting up our social profiles meant making the same design at nine different sizes, each with its own corner covered by a profile picture or cropped on phones. share-cards does it from one HTML file with headless Chrome. It grew out of the scripts that make the share images on this site, including the card you see when an update is shared.

One template, every size

You design once in HTML and CSS, with your own fonts and SVG. share-cards opens the page in Chrome at each size and saves a picture. This is the example template from the repository, rendered at six of the nine sizes:

The same share-cards example rendered as a link preview, X header, LinkedIn cover, square post, profile picture and story

Safe areas

Every platform hides part of its image somewhere. X puts your profile picture over the lower left of the header, YouTube shows only a thin strip of channel art on phones, and stories lose their top and bottom to buttons. Each preset knows its safe area and passes it to the template as safeW and safeH, so the text lands where every device will show it. The presets cover link previews, X and LinkedIn headers, YouTube channel art, square and portrait posts, stories and profile pictures, and --width and --height handle anything else.

Many cards at once

For a batch, list the cards in a JSON file, each with its template, size, output file and values such as the title, then run share-cards build cards.json. It has no dependencies beyond Node 20 and Chrome, so it runs the same on a laptop and in a CI job.

Get started

npx github:firedanceio/share-cards render card.html -o og.png -p og -s title="Hello"

Full instructions are in the README on GitHub.

Read the announcement: share-cards: social images from one HTML file.

Get updatesGet the early-bird price

Firedance isn't available yet. Leave your email and we'll let you know when it launches.

Leave your email and you'll hear first when Firedance launches, so you can get the early-bird price.