Back to articles
I Built an API That Generates OG Images in 50ms — No Puppeteer Needed

I Built an API That Generates OG Images in 50ms — No Puppeteer Needed

via Dev.to WebdevNarender singh

Every website needs Open Graph images for social sharing. But generating them is a pain: Puppeteer/Playwright : Spin up a headless browser, render HTML, screenshot it. Slow (~2-5 seconds), heavy (200MB+ Chrome binary), expensive to host. Canvas libraries : Write imperative drawing code. No hot reload, no component reuse, painful text layout. Manual design : Open Figma for each page. Doesn't scale past 10 pages. I wanted something simpler. So I built OGPix — an API that generates beautiful OG images from URL parameters in ~50ms. How It Works Your og:image meta tag becomes a URL: <meta property= "og:image" content= "https://ogpix-pi.vercel.app/api/og?title=My+Article&theme=dark&key=YOUR_KEY" /> That's it. When anyone shares your link on Twitter, LinkedIn, Slack, or Discord — they see a beautiful preview image generated on the fly. 8 Themes Gradient — Bold purple gradient Minimal — Clean white background Dark — Sleek dark mode Sunset — Warm orange tones Ocean — Deep blue Forest — Nature g

Continue reading on Dev.to Webdev

Opens in a new tab

Read Full Article
2 views

Related Articles