An Open Graph image generator turns each page’s title and data into a share card, so you stop exporting one image per post by hand. The hard part is not drawing the card. It is serving a URL that a social crawler will accept on its first try, for every page, without an API key in the HTML.
What the Open Graph protocol requires
The Open Graph protocol names four required properties for every page: og:title, og:type, og:image, and og:url. It also says that a page specifying og:image should specify og:image:alt, and defines og:image:width and og:image:height. Tags go in the <head> of server-rendered HTML.
Three ways to produce the image
| Approach | Layout lives in | Who edits the layout | Limits |
|---|---|---|---|
| Hand export from a design tool | A design file | Designer | One export per page |
Code, such as Next.js ImageResponse |
Your repo | Engineer | Flexbox and a CSS subset, 500KB bundle |
| Template API with signed URLs | An editor template | Designer | What the editor can draw |
Hand export stops scaling at the tenth post. Code scales, but every layout tweak is a deploy. The template route keeps the designer in charge of the canvas and the engineer in charge of the payload. The Next.js trade-off is covered in Next.js OG Image: ImageResponse or a Template API?.
The signed-URL flow
- Design a 1,200 by 630 template and name a
headlinelayer. 1,200 by 630 is the default size of Next.jsImageResponse. - When a page renders, call
POST /api/v1/img/signwith the template, format, and layer values. Minting costs no credit. - Put the returned
urlinog:image. - The crawler fetches it with no key. The first unique URL renders and bills one credit; the same title again streams the stored file.
const { url } = await client.signImageUrl({
template: "<design-id>",
format: "png",
layers: { headline: { text: post.title } },
});
If the first render is still running, jsontoimg responds 503 with Retry-After, and crawlers retry. A tampered query string fails signature verification with 401. The full failure list is in OG Image Debugger Checklist.
Checklist before you ship
- Set an absolute
httpsURL inog:image. - Add
og:image:alt, as the protocol asks. - Render the tags on the server, not after hydration.
- Test the page in the Facebook Sharing Debugger and the LinkedIn Post Inspector.
Where to go next
- WordPress: WordPress Open Graph Images from Post Titles
- Next.js signing walkthrough: Sign Open Graph Image URLs in Next.js and WordPress
- Other share formats: social posts, YouTube thumbnails, Pinterest pins, testimonial images, and the Open Graph images use case
FAQ
What is an Open Graph image generator?
A tool that builds the share-card image for each page from its title and data, then serves it as the og:image URL. jsontoimg does this with one template and signed URLs, so no API key reaches the page.
What size should an Open Graph image be?
1,200 by 630 pixels is the default size in Next.js ImageResponse and a common design target. Declare it with og:image:width and og:image:height so crawlers do not have to guess.
Do I need og:image:alt?
The Open Graph protocol says a page that specifies og:image should also specify og:image:alt, a description of what is in the image.
How much does it cost to generate Open Graph images?
Minting a signed URL is free. The first unique fetch of each URL costs one credit, and repeat fetches of the same title are served from storage at no extra credit.
Related Resources
- How JSON-to-image conversion works — the pillar guide
- OG Image Debugger Checklist — why a preview is blank
- Open Graph images use case — signed OG URLs from JSON
- URL rendering docs — mint and fetch reference