Satori

Satori

ALT: Add Unicode Private Area Support #161 Merged

Merged! Add Unicode Private Area Support #161

Resources

Introducing OG Image Generation: Fast, dynamic social card images at the Edge - Vercel

Problems

  • Difficult: This solution required launching in a Function and taking a screenshot of the given page with Puppeteer. Setting up these tools was hard to implement and often led to errors
  • Slow: needs to be compressed to fit inside a Function and then decompressed on a cold boot; it's very slow (~4 seconds on average). This can result in slow or broken social card images
  • Expensive: Spinning up an entire to take a screenshot was not efficient. This led to large Function sizes, which could be expensive and waste computing

@vercel/og

  • Easy: No is needed. Using OG, you can define your images using and and automatically generate dynamic images from the generated SVGs
  • Affordable: Edge Functions are ~160x cheaper than running in a Function. Further, generated images can be cached and stored at the Edge
  • Fast: OG (500KB) is 100x more lightweight than + Puppeteer (50MB). 5x faster in P99 TTFB (4.96s → 0.99s) and 5.3x faster in P90 (4s → 0.75s).

Features

  • Basic layout, styling, and typography.
  • Works with any framework or application
  • and Subsets from Google Fonts and other CDNs
  • with the tw prop
  • Handles Cache automatically

Engine

  • The core engine, Satori, can be used in modern , , and . Building on top of the core engine, OG can be used inside Edge environments through WebAssembly to create social card images easily.

Backstory by Shu

Backlinks5