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.
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
-
Music sync and the ECG: measuring a beat
A heart monitor and a music-synced light show solve the same problem: turning a noisy waveform into beats and a rate. Where the two match and where they differ.
-
Mixing smart light brands in one room
We run WiZ, LIFX, Govee, GE Cync and Sengled lights side by side. What we wish we'd known about pairing, routers and mixing smart light brands in one room.
-
kicad-fab-tools: circuit board orders, checked
Ordering a circuit board takes a stack of files and careful checking. kicad-fab-tools turns a KiCad design into an order and catches costly mistakes.