Quick Start
Render an HTML file to SVG:
ogre --render template.html --output og.svgRender inline HTML to PNG:
ogre --html '<div class="flex w-full h-full bg-blue-500 items-center justify-center"><div class="text-4xl font-bold text-white">Hello</div></div>' --output og.png --format pngStart the HTTP server:
ogre --serve --port 3000Go library
Section titled “Go library”package main
import ( "os"
"github.com/macawls/ogre")
func main() { result, err := ogre.Render(` <div class="flex flex-col w-full h-full bg-slate-900 p-16 justify-center"> <div class="text-5xl font-bold text-white">My Blog Post</div> <div class="text-xl text-slate-400 mt-4">A subtitle here</div> </div> `, ogre.Options{Width: 1200, Height: 630}) if err != nil { panic(err) }
os.WriteFile("og.svg", result.Data, 0644)}HTTP API
Section titled “HTTP API”With the server running:
curl -X POST http://localhost:3000/render \ -H "Content-Type: application/json" \ -d '{ "html": "<div class=\"flex w-full h-full bg-blue-500 items-center justify-center\"><div class=\"text-4xl font-bold text-white\">Hello</div></div>", "width": 1200, "height": 630, "format": "png" }' \ -o og.png