JSXImage
On this page

Create and serve Open Graph images

An Open Graph image is the picture that shows when a link is shared on LinkedIn, X, Slack, iMessage or Discord. This guide makes one template that matches your brand, then gives every page its own image, with that page’s title, from a URL you build in your own code. No image files to store, no build step.

You need a JSXImage account (the free trial is enough) and about 15 minutes.

In a hurry? One meta tag, no account

For an image right now, use the free Open Graph URL. Put this in the page’s <head>, with the page’s own title:

<meta
  property="og:image"
  content="https://jsximg.com/tools/og-image-generator.png?title=How+we+cut+build+times+in+half&site=acme.dev"
/>

Besides title and site (your domain), it takes an optional description (a line under the title), your brand’s bgColor and fgColor (hex, such as ff5a1f) and a googleFont: any Google Font by name, such as Space+Grotesk (the built-in Geist without it). Try them in the Open Graph image generator, which writes the tag for you, or copy the snippet for Astro, Next.js, Hugo, Jekyll or Eleventy. The free image uses that one design, with a small jsximage.com mark in the corner. The rest of this guide gives you your own design, without the mark.

How it works

  1. A template is a React component styled with Tailwind, 1200 × 630 px. Its export const props lists the values that change per page, such as title and description.
  2. A signed URL points at the template with the props for one page: https://jsximg.com/i/<template-uid>.png?title=…&s=<signature>. Your server builds it with your signing key, so nobody else can make images on your account.
  3. The og:image tag in the page’s <head> uses that URL. The first time a crawler or a person opens it, JSXImage renders the image and caches it at the edge. Every open after that is served from the cache.

Step 1: design the template

Pick one of three ways. They all end with a saved template in the playground.

By hand in the playground

  1. Open the playground, click Templates and choose the Open Graph image example.
  2. Change the design in the editor. The preview updates as you type.
  3. Keep the values that differ per page in export const props, and read them as props.title:
export const props = {
  title: "How we cut build times in half",
  description: "Incremental caching in our CI, step by step.",
};

type Props = typeof props;

export default function OgImage(props: Props) {
  return (
    <div class="flex h-full w-full flex-col justify-between bg-slate-950 p-16 text-white">
      <span class="text-2xl text-slate-400">acme.dev</span>
      <div class="flex flex-col gap-4">
        <h1 class="m-0 text-7xl font-bold leading-tight">{props.title}</h1>
        <p class="m-0 text-3xl text-slate-300">{props.description}</p>
      </div>
    </div>
  );
}

export const options = { width: 1200, height: 630, format: "png" };
  1. Sign in, give it a name and click Save.

Use realistic defaults: the preview shows them, so a long default title tells you early whether long titles still fit.

With your AI assistant (MCP)

Add the JSXImage MCP server to your assistant. In Claude Code:

claude mcp add --transport http jsximage https://jsximage.com/mcp

Other clients take the server URL https://jsximage.com/mcp; see Use with an AI assistant. Then ask for the image, for example:

Create an Open Graph image template for my blog, 1200 × 630. Dark navy background, our accent color #ff7a59, the post title large, a one-line description below it, and acme.dev in the top left. Props: title and description.

The assistant writes the template and gives you a link. Open it, check the preview, then sign in and click Save. The link works for 7 days until you save it.

From your own site, with Claude in Chrome

The best match for your brand comes from your actual site. With the Claude in Chrome extension, Claude can open your pages, read your colors, fonts and logo, and write the template from them.

  1. Install Claude in Chrome, and add JSXImage to Claude as a connector with the server URL https://jsximage.com/mcp.
  2. Ask Claude something like:

Open https://acme.dev and two of its blog posts. Note the brand colors, the heading and body fonts, and the logo. Then create a JSXImage Open Graph template, 1200 × 630, that looks like it belongs to the site: the post title large, a one-line description, and the logo. Use Google Fonts that match. Props: title and description.

  1. Open the link Claude returns, adjust anything you like in the editor, sign in and click Save.

Claude picks the closest Google Fonts with the googleFont option. If your logo is an image on your site, it can use its URL in an <img>; SVG logos can be pasted inline.

Step 2: get the images

One image, from the playground

For a single page, such as your home page, you don’t need any code:

  • Create URL gives a live image URL with the props in the editor. Paste it into the page’s og:image tag. It follows the template: if you change the design and save, the URL shows the new design.
  • Export image (in the menu next to Create URL) downloads a PNG to host yourself. It is a copy: it doesn’t change with the template.

An image per page, with signed URLs

For blog posts, docs pages, products or user profiles, build the URL in your own code with each page’s props. Signing happens on your server, so there is no API call per page.

  1. In the playground, open your saved template, click the arrow next to Create URL and choose Sign URLs in your code. It shows a ready-made imageUrl() function with your template’s uid filled in.
  2. Copy your signing key (jsxsk_…) from the API keys page and store it as a server-side secret, for example JSXIMAGE_SIGNING_KEY. Never put it in browser code.
  3. Call the function with each page’s props.

The function, for Node 18+, Bun, Deno and Cloudflare Workers:

const TEMPLATE = "<template-uid>";
const SIGNING_KEY = process.env.JSXIMAGE_SIGNING_KEY;

export async function ogImageUrl(props) {
  const file = `${TEMPLATE}.png`;
  const query = new URLSearchParams(props).toString();
  const key = await crypto.subtle.importKey(
    "raw",
    new TextEncoder().encode(SIGNING_KEY),
    { name: "HMAC", hash: "SHA-256" },
    false,
    ["sign"],
  );
  const signature = await crypto.subtle.sign(
    "HMAC",
    key,
    new TextEncoder().encode(`${file}?${query}`),
  );
  const s = [...new Uint8Array(signature)]
    .map((byte) => byte.toString(16).padStart(2, "0"))
    .join("");
  return `https://jsximg.com/i/${file}?${query}&s=${s}`;
}

Every value in the query is text, which is what titles and descriptions are. For numbers or lists, send all props as JSON instead: see Props as JSON. Other languages: Signing URLs yourself.

Astro, in a layout:

---
import { ogImageUrl } from "../lib/og-image";
const { title, description } = Astro.props;
const image = await ogImageUrl({ title, description });
---
<meta property="og:image" content={image} />
<meta name="twitter:card" content="summary_large_image" />
<meta name="twitter:image" content={image} />

Next.js (App Router), per page:

import { ogImageUrl } from "@/lib/og-image";

export async function generateMetadata({ params }) {
  const post = await getPost((await params).slug);
  const image = await ogImageUrl({
    title: post.title,
    description: post.excerpt,
  });
  return {
    title: post.title,
    openGraph: { images: [image] },
    twitter: { card: "summary_large_image", images: [image] },
  };
}

Step 3: check it

  • Look at the page source. The & between parameters shows as &amp; in HTML; that is correct, and crawlers read it as &. If you paste the URL into a browser, use &.
  • Preview the share. Paste a page URL into opengraph.xyz or LinkedIn’s Post Inspector.
  • A blank or broken image usually means the signature doesn’t match: sign exactly the query string you put in the URL, with the signing key of the organization that owns the template.

Good to know

  • Quota. Each URL uses one render the first time it is opened. Opening it again, by people or crawlers, is free. A different title is a different URL.
  • Design changes follow automatically. Edit and save the template, and every page’s image shows the new design, with its own title.
  • Caching. Social networks cache images on their side. After a design change, LinkedIn’s Post Inspector refreshes its copy for a page.
  • Text length. Long titles need room. Test the longest title you have in the playground, and shorten or clamp it in the template if needed.

Questions? See the docs or email info@jsximage.com.