Newsletter
Join the Community
Subscribe to our newsletter for the latest news and updates
Generate Open Graph thumbnails from HTML/CSS templates without a headless browser. Works via CLI, API, and plugins for Astro, Vite, Rollup, Express.
og-images-generator is an open-source Node.js tool that generates Open Graph social sharing thumbnails from plain HTML and CSS templates, without a headless browser, by converting HTML to SVG and then to PNG.
og-images-generator is an open-source Node.js utility that creates Open Graph (social sharing) thumbnail images for websites from plain HTML and CSS templates. It accepts metadata extracted from pages—parsing all meta tags in the head and JSON-LD script tags in head and body—and outputs PNG images sized for social media cards. The tool runs in Node.js environments and is developed by Julian Cataldo, published on npm under the package name og-images-generator with an ISC license. It integrates with Astro, Express, Rollup, Vite, and Web Dev Server via plugins, and also offers a CLI and a programmatic API.
page.meta and page.url for use in your image template, so existing SEO tags can drive the card content.npx generate-og), a JS API (og-images-generator/api), an Express/Connect middleware, and plugins for Rollup, Vite, Web Dev Server, and an Astro integration.styled.div and html template literal tags for syntax highlighting and formatting, with interpolation of HTML attributes without quoting.page.url plus metadata, allowing conditional logic to render different card designs for different pages.renderOptions accepts Satori options (e.g., custom fonts via helpers like FONTS.sourceSans(), and size via OG_SIZE), exposing all underlying APIs for fine-tuned output.graphemeImages option, and Lit SSR encodes HTML entities that Satori doesn't decode (og-images-generator decodes the final template itself).dist/og).template, and every page in dist gets a dist/og/<page>.png matching its route.renderOgImage API to produce a PNG from any route when a crawler or social media bot requests it.The tool crawls your built HTML (either from a folder like dist or via middleware at runtime), parses <meta> tags and JSON-LD scripts, and passes them to your custom template. That template—an HTML string with inline styles—is fed to Satori, which converts it to an SVG while preserving layout and typography calculations. Finally, resvg-js rasterizes the SVG to a PNG at the configured size (e.g., OG_SIZE), and the files land in the output directory.
Pros:
Cons:
graphemeImages option is used; the README suggests stripping them with a library like emoji-strip.\n and \t line breaks.og-images-generator is free and open-source, released under the ISC license. It is available on npm for installation without any fee.
Yes, it is open-source under the ISC license and available on npm for free.
No, it converts HTML/CSS to SVG via Satori and then to PNG with resvg-js, so there's no Puppeteer or Chromium dependency.
It offers a CLI, a JavaScript API, an Express/Connect middleware, and plugins for Rollup, Vite, Web Dev Server, and Astro.
You branch on page.url inside a single root template, or import separate partial templates; the tool passes page metadata alongside the URL.
A known issue: emojis don't work with Satori's graphemeImages option; the workaround is to strip emojis from text with a library like emoji-strip.
