Template
OG image template
This OG image template is the social preview image for your site, written as HTML and CSS and rendered to a 1200 by 630 PNG. Variants cover a centered home page card, a blog post card with author and read time, and a dark docs card.
It lives in your repo next to the code, so an agent can make a new card for each post and the CLI renders it in CI.

OG image guide OG template source on GitHub
Static OG images, rendered ahead of time
Many frameworks generate OG images at request time with a restricted subset of CSS. This template renders ahead of time in a real Chromium, so grid, gradients, web fonts and backdrop filters all work, and the result is a static file your host serves with no function.
Use it for pages that change rarely: the home page, product pages, docs sections and each blog post. For thousands of user generated pages, a request time renderer is still the better fit.
One card per blog post
The blog variant takes the title, author and read time as text in the HTML. Copy the file per post, or keep one file and drive it from localizations.json with a key per post. Long titles wrap to three lines at 64 pixels, which is about 70 characters.
Point your page metadata at the rendered PNG with outFile, so it lands in your public folder under a stable path.
Use it for X cards too
X shows summary_large_image cards at roughly 1.91 to 1, which is the same shape as 1200 by 630. Add the twitter-card export if you want a 1200 by 675 version for posts.
Agent prompt
Using Open Assets (npx open-assets), add an og-image collection to assets.json with sourceSize 1200x630 and the og export. Create assets/og/01-centered.html with my logo and site tagline centered on a brand gradient, and assets/og/02-blog.html with a post title, author and read time. Use outFile to write the home card to public/og.png. Render with npx open-assets render and wire the PNG into my page metadata.assets.json collection
{
"id": "og-image",
"label": "OG image",
"sourceSize": {
"width": 1200,
"height": 630
},
"templates": [
{
"src": "assets/og/01-centered.html",
"name": "01-centered"
},
{
"src": "assets/og/02-blog.html",
"name": "02-blog"
},
{
"src": "assets/og/03-docs.html",
"name": "03-docs"
}
],
"export": [
{
"name": "og",
"size": {
"width": 1200,
"height": 630
}
}
]
}Sizes it renders
| Platform | Size | Pixels | Name in assets.json | Copy |
|---|---|---|---|---|
| Web | OG image | 1200 × 630 | og | |
| Web | X / Twitter card | 1200 × 675 | twitter-card |
FAQ
Frequently asked questions
What size should an OG image be?
1200 by 630 pixels is the size Facebook, LinkedIn, Slack and X all display well. Keep text away from the outer 60 pixels in case of cropping.
Is this a free OG image generator?
Open Assets is free and open source under the MIT license. It is a CLI rather than a web form, so the template and the image both stay in your repo.
Can I make OG images with Tailwind?
Yes. Templates are plain HTML, so the Tailwind CDN script or a built stylesheet both work.
Should OG images be PNG or JPEG?
PNG for flat graphics and text; JPEG for photos to keep the file small. Name the outFile with .jpg to get JPEG.