share-cards: social images from one HTML file

Every social site wants a different image size. share-cards turns one HTML design into all of them, with each platform's cropping in mind. It's free on GitHub.

A dark desk with a computer monitor showing mountains, a keyboard and a small lamp

Each social site asks for an image of its own size, and setting up our social profiles therefore meant making a large number of images. A link preview measures 1200 by 630 pixels. An X header measures 1500 by 500, and the profile picture is placed over one of its corners. YouTube channel art is 2560 by 1440, although phones display only a thin strip across its middle.

We had no wish to redraw the same design ten times, so we built a tool to do it, and today that tool becomes our next open source release.

share-cards

share-cards takes one design, written as an ordinary web page, and saves it as an image at every size that is required. The safe area of each platform, which is the part that is never cropped, is known to the tool, so that titles and logos are kept in view.

Nine sizes are built in, covering link previews, X and LinkedIn headers, YouTube channel art, Instagram posts and stories, and profile pictures. Any other size is produced when a width and a height are given to the tool.

The design is left entirely to the user, since any font, colour or graphic that a web page is able to show will appear in the image. A single card can be rendered from the command line, or a whole batch can be listed in one file and produced at once.

We built share-cards from the scripts that make the images for every post on this site and on our social profiles. It runs on Mac, Windows and Linux with Node and Chrome, and it is free under the Apache 2.0 license.

View share-cards on GitHub · Project page

More this month

share-cards is the second of six open source releases leading up to Halloween. The rest of them can be found on GitHub, and a sign-up for updates gives notice of each one.

More from Firedance

Hear when FirePod goes on saleGet the early-bird price

FirePod isn't on sale yet. Leave your email and we'll write when it is.

FirePod isn't on sale yet. Sign up and the early-bird price comes to your inbox when it is.