image
vercel-labs/json-render
Convert JSON specs to SVG and PNG images using Satori for OG images and social cards.
What is image?
Image renderer for json-render that transforms JSON specifications into SVG and PNG images via Satori. Use it when generating Open Graph images, creating social media cards, or rendering AI-generated image layouts from structured data.
- Render JSON specs to SVG strings or PNG buffers
- Support standard layout components (Frame, Box, Row, Column) and content components (Heading, Text, Image)
- Add custom components with Zod schema validation
- Configure fonts, dimensions, backgrounds, and styling via JSON
- Generate images server-side without browser dependencies
How to install image
npx skills add https://github.com/vercel-labs/json-render --skill image- Node.js environment
- @json-render/core package installed
- @resvg/resvg-js for PNG output (optional, required only for renderToPng)
- Font data files if using custom fonts
How to use image
- 1.Import renderToPng or renderToSvg from @json-render/image/render
- 2.Define a JSON spec with a root Frame element and child elements
- 3.Configure component props (dimensions, text, colors, positioning)
- 4.Optionally register custom components using defineCatalog and Zod schemas
- 5.Call renderToPng(spec, options) or renderToSvg(spec) to generate output
- 6.Use the returned buffer or SVG string in your application
Use cases
- Generate dynamic Open Graph preview images for web pages
- Create social media card images from JSON templates
- Render AI-generated image specifications into actual images
- Build image generation APIs that accept JSON payloads
- Generate branded social cards with dynamic text and layouts
- Full-stack developers building image generation features
- AI agents generating visual content from structured specs
- Backend engineers creating dynamic OG image services
- Teams automating social media card creation
image FAQ
renderToSvg returns an SVG string suitable for embedding or serving directly; renderToPng returns a PNG buffer and requires @resvg/resvg-js as a peer dependency.
Yes, pass a fonts array in the options object with font name, data, weight, and style properties.
Standard components include Frame (root), Box, Row, Column (layout), Heading, Text, Image (content), and Divider, Spacer (decorative).
Use defineCatalog with standardComponentDefinitions and extend it with your own components, each with a Zod schema for props and a description.
Yes, use the @json-render/image/server sub-path export which contains only schema and definitions without React or Satori dependencies.
Full instructions (SKILL.md)
Source of truth, from vercel-labs/json-render.
name: image description: Image renderer for json-render that turns JSON specs into SVG and PNG images via Satori. Use when working with @json-render/image, generating OG images from JSON, creating social cards, or rendering AI-generated image specs.
@json-render/image
Image renderer that converts JSON specs into SVG and PNG images using Satori.
Quick Start
import { renderToPng } from "@json-render/image/render";
import type { Spec } from "@json-render/core";
const spec: Spec = {
root: "frame",
elements: {
frame: {
type: "Frame",
props: { width: 1200, height: 630, backgroundColor: "#1a1a2e" },
children: ["heading"],
},
heading: {
type: "Heading",
props: { text: "Hello World", level: "h1", color: "#ffffff" },
children: [],
},
},
};
const png = await renderToPng(spec, {
fonts: [{ name: "Inter", data: fontData, weight: 400, style: "normal" }],
});
Using Standard Components
import { defineCatalog } from "@json-render/core";
import { schema, standardComponentDefinitions } from "@json-render/image";
export const imageCatalog = defineCatalog(schema, {
components: standardComponentDefinitions,
});
Adding Custom Components
import { z } from "zod";
const catalog = defineCatalog(schema, {
components: {
...standardComponentDefinitions,
Badge: {
props: z.object({ label: z.string(), color: z.string().nullable() }),
slots: [],
description: "A colored badge label",
},
},
});
Standard Components
| Component | Category | Description |
|---|---|---|
Frame | Root | Root container. Defines width, height, background. Must be root. |
Box | Layout | Container with padding, margin, border, absolute positioning |
Row | Layout | Horizontal flex layout |
Column | Layout | Vertical flex layout |
Heading | Content | h1-h4 heading text |
Text | Content | Body text with full styling |
Image | Content | Image from URL |
Divider | Decorative | Horizontal line separator |
Spacer | Decorative | Empty vertical space |
Key Exports
| Export | Purpose |
|---|---|
renderToSvg | Render spec to SVG string |
renderToPng | Render spec to PNG buffer (requires @resvg/resvg-js) |
schema | Image element schema |
standardComponents | Pre-built component registry |
standardComponentDefinitions | Catalog definitions for AI prompts |
Sub-path Exports
| Export | Description |
|---|---|
@json-render/image | Full package: schema, components, render functions |
@json-render/image/server | Schema and catalog definitions only (no React/Satori) |
@json-render/image/catalog | Standard component definitions and types |
@json-render/image/render | Render functions only |
Related skills
More from vercel-labs/json-render and the wider catalog.

ink
Ink terminal renderer for json-render that turns JSON specs into interactive terminal UIs. Use when working with @json-render/ink, building terminal UIs from JSON, creating terminal component catalogs, or rendering AI-generated specs in the terminal.

jotai
Jotai adapter for json-render's StateStore interface. Use when integrating json-render with Jotai for state management via @json-render/jotai.

mcp
Build interactive UIs in Claude, ChatGPT, Cursor, and VS Code via MCP servers using json-render.

next
Convert JSON specs into full Next.js applications with routes, layouts, SSR, and metadata.

react
Convert JSON specs into React components with type-safe props, state binding, and event handling.

react-email
Convert JSON specs into HTML or plain-text emails using React Email components.