Skip to main content
OGify’s rendering engine (renderTemplate) converts template output into a PNG buffer through a five-step pipeline powered by Satori and Resvg.

Pipeline Overview

1

Font Loading

All fonts from the template (or options.fonts override) are loaded in parallel. Sources are resolved in priority order: pre-loaded data → remote url → Google Fonts API.
2

Markup Generation

The template renderer is called with merged parameters and render options. It returns either an HTML string or a React node tree.
3

Element Tree

  • HTML string → parsed with satori-html (classtw)
  • React node → passed directly to Satori (no HTML parsing step)
4

SVG Rendering

Satori renders the element tree to SVG at the original width × height (default 1200 × 630). Font sizes and layout values stay correct regardless of scale.
5

PNG Rasterization

Resvg rasterizes the vector SVG at width × scale pixels wide (default scale = 1). See Scale & Supersampling for details.

Renderer Context

Every renderer function receives OgTemplateOptions merged with params:
TParams
required
Merged template parameters (sharedParams + user params from renderToImage). User values take precedence.
number
default:1200
Canvas width in pixels. Always the original dimension — not affected by scale.
number
default:630
Canvas height in pixels. Always the original dimension.
OgFontConfig[]
Font override from renderToImage options. Falls back to the template’s fonts array when omitted or empty.
OgEmojiProvider
Emoji provider override. Falls back to the template’s emojiProvider, then 'noto'.
boolean
default:false
Enable right-to-left text direction and layout mirroring.
number
default:1
Supersampling factor passed through for awareness. Templates should not use scale for layout — Satori always renders at width × height. Only Resvg uses scale for final PNG dimensions.

Return Types

Returning null or undefined at the root throws a clear error instead of failing silently in the Satori pipeline.

JSX vs HTML String

Scale / Supersampling

scale only affects Resvg PNG output — not Satori layout. Templates always design against original width/height.

Scale & Supersampling

Why scale does not change layout, correct vs incorrect usage, and output dimensions
Pass scale via renderToImage options — not in template layout code:

Default Dimensions

OGify uses the Open Graph protocol recommended dimensions:
  • Width: 1200px
  • Height: 630px
  • Aspect ratio: 1.91:1 (works across Facebook, Twitter, LinkedIn, Discord)