Skip to content

Introduction

Ogre is a pure Go alternative to Vercel’s Satori for converting HTML and CSS into SVG, PNG, and JPEG images. It is designed for generating OpenGraph images, social cards, and dynamic image content from templates.

When you share a link on Twitter, Slack, Discord, or LinkedIn, a preview image appears. That image is an OpenGraph (OG) image. Instead of designing a static image for every page, you can generate them from an HTML template.

Ogre handles this. Write HTML with inline styles or Tailwind classes, pass it to Ogre, get an image back. Use it as a Go library, a standalone CLI, or a self-hosted HTTP server. Blog post cards, documentation pages, event banners, repo cards, or any dynamic image your application needs.

Terminal window
go install github.com/macawls/ogre/cmd/ogre@latest
result, _ := ogre.Render(`
<div class="flex w-full h-full bg-slate-900 p-16 items-center justify-center">
<div class="text-5xl font-bold text-white">Hello World</div>
</div>
`, ogre.Options{Width: 1200, Height: 630})
os.WriteFile("og.svg", result.Data, 0644)

Dynamic image generation (OG cards, social previews, certificates, invoices) typically involves one of these:

  • Satori requires a JavaScript runtime. For non-JavaScript backends, that means a separate service.
  • Headless Chrome / Puppeteer uses hundreds of megabytes of RAM and takes seconds per render.
  • Image manipulation libraries (like Go’s image package) work but require manual layout instead of HTML/CSS.

Ogre compiles to a single static binary with CGO_ENABLED=0. Add it as a dependency and call ogre.Render(), or run it as a standalone HTTP server.

OgreSatori
Binary11 MB static binaryJavaScript runtime required
Simple render0.03–0.08 ms0.3–2.5 ms
Complex render3–8 ms4–17 ms
OutputSVG, PNG, JPEGSVG only
Use as librarygo get, one functionnpm package

Render times measured on AMD Ryzen 5 5600H, 1200x630 renders, both producing SVG. Full benchmark data in Satori Comparison.

  • Pure Go. No CGo, no external binaries. Single static binary with CGO_ENABLED=0.
  • Output quality first. The priority is correct, complete rendering — PNG/JPEG output, inline SVGs, box shadows, CSS filters, transforms, RTL text. Performance optimizations follow once output fidelity is solid.
  • Tailwind built-in. Resolves Tailwind v3 utility classes directly. No build step needed.
  • Production-ready server. Includes an HTTP server with LRU caching, rate limiting, and template support.

Standard library, golang.org/x/*, and one external package:

  • golang.org/x/net/html for HTML parsing
  • golang.org/x/image/font for font interfaces and rasterization
  • golang.org/x/image/vector for 2D vector path rasterization
  • golang.org/x/text/unicode/bidi for bidirectional text
  • github.com/go-text/typesetting for text shaping (kerning, ligatures, RTL)
FormatContent TypeNotes
SVGimage/svg+xmlFont glyphs embedded as path data. Self-contained.
PNGimage/pngRasterized with gradient support.
JPEGimage/jpegConfigurable quality (default 90).