Skip to content

CLI Usage

The ogre CLI renders HTML files or inline HTML strings to images.

FlagDefaultDescription
--servefalseStart HTTP server mode
--port3000Server port (only with --serve)
--renderPath to an HTML file to render
--htmlInline HTML string to render
--outputOutput file path. Required for PNG/JPEG. If omitted for SVG, writes to stdout.
--width1200Canvas width in pixels
--height630Canvas height in pixels
--formatsvgOutput format: svg, png, or jpeg
Terminal window
ogre --render card.html --output card.svg

The HTML file should contain a single root <div> with inline styles or Tailwind classes.

Terminal window
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.svg

SVG output goes to stdout by default:

Terminal window
ogre --render card.html > card.svg

PNG and JPEG require --output:

Terminal window
ogre --render card.html --output card.png --format png
ogre --render card.html --output card.jpg --format jpeg
Terminal window
ogre --render card.html --output card.png --format png --width 800 --height 400
Terminal window
ogre --serve --port 8080

See the HTTP Server guide for details.