PluginBench
Skill
Official
Pass
Audit score 90

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
Prerequisites
  • 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
Claude Code
Cursor
Windsurf
Cline

How to use image

  1. 1.Import renderToPng or renderToSvg from @json-render/image/render
  2. 2.Define a JSON spec with a root Frame element and child elements
  3. 3.Configure component props (dimensions, text, colors, positioning)
  4. 4.Optionally register custom components using defineCatalog and Zod schemas
  5. 5.Call renderToPng(spec, options) or renderToSvg(spec) to generate output
  6. 6.Use the returned buffer or SVG string in your application

Use cases

Good for
  • 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
Who it's for
  • 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

What's the difference between renderToSvg and renderToPng?

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.

Can I use custom fonts?

Yes, pass a fonts array in the options object with font name, data, weight, and style properties.

What components are available out of the box?

Standard components include Frame (root), Box, Row, Column (layout), Heading, Text, Image (content), and Divider, Spacer (decorative).

How do I add custom components?

Use defineCatalog with standardComponentDefinitions and extend it with your own components, each with a Zod schema for props and a description.

Can this run on the server only?

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

ComponentCategoryDescription
FrameRootRoot container. Defines width, height, background. Must be root.
BoxLayoutContainer with padding, margin, border, absolute positioning
RowLayoutHorizontal flex layout
ColumnLayoutVertical flex layout
HeadingContenth1-h4 heading text
TextContentBody text with full styling
ImageContentImage from URL
DividerDecorativeHorizontal line separator
SpacerDecorativeEmpty vertical space

Key Exports

ExportPurpose
renderToSvgRender spec to SVG string
renderToPngRender spec to PNG buffer (requires @resvg/resvg-js)
schemaImage element schema
standardComponentsPre-built component registry
standardComponentDefinitionsCatalog definitions for AI prompts

Sub-path Exports

ExportDescription
@json-render/imageFull package: schema, components, render functions
@json-render/image/serverSchema and catalog definitions only (no React/Satori)
@json-render/image/catalogStandard component definitions and types
@json-render/image/renderRender functions only