CLI Usage
The ogre CLI renders HTML files or inline HTML strings to images.
| Flag | Default | Description |
|---|---|---|
--serve | false | Start HTTP server mode |
--port | 3000 | Server port (only with --serve) |
--render | Path to an HTML file to render | |
--html | Inline HTML string to render | |
--output | Output file path. Required for PNG/JPEG. If omitted for SVG, writes to stdout. | |
--width | 1200 | Canvas width in pixels |
--height | 630 | Canvas height in pixels |
--format | svg | Output format: svg, png, or jpeg |
Rendering a file
Section titled “Rendering a file”ogre --render card.html --output card.svgThe HTML file should contain a single root <div> with inline styles or Tailwind classes.
Rendering inline HTML
Section titled “Rendering inline HTML”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 hello.svgOutput formats
Section titled “Output formats”SVG output goes to stdout by default:
ogre --render card.html > card.svgPNG and JPEG require --output:
ogre --render card.html --output card.png --format pngogre --render card.html --output card.jpg --format jpegCustom dimensions
Section titled “Custom dimensions”ogre --render card.html --output card.png --format png --width 800 --height 400Server mode
Section titled “Server mode”ogre --serve --port 8080See the HTTP Server guide for details.