ImageResponse

A Next.js class from next/og that turns JSX and a subset of CSS into a PNG image response.

In more detail

It uses Satori to lay out the JSX as SVG and Resvg to convert that to PNG. Only flexbox layout and a subset of CSS work, and it runs in both the Node.js and Edge runtimes.

Example

return new ImageResponse(<div style={{ display: 'flex', fontSize: 64 }}>{title}</div>, { width: 1200, height: 630 });

Related terms

Taught in

References