Skip to content

HTML to Image

POST /render rasterizes an HTML document to an image and returns the image binary. It’s useful for thumbnails, social-card previews, or anywhere you need a bitmap instead of a PDF. It uses the same rendering engine as HTML to PDF, so the same HTML and CSS support — and the same limitations (no JavaScript, Flexbox, or Grid) — apply.

Send the HTML and pick a format; the response body is the image, so write it straight to a file:

Terminal window
curl -X POST http://localhost:8080/render \
-H "Content-Type: application/json" \
-d '{"html":"<html lang=\"en\"><head><title>Doc</title></head><body><h1>Hi</h1></body></html>","format":"png","width":800}' \
--output out.png

The request body accepts these fields:

FieldDefaultMeaning
htmlThe HTML document to render (required)
formatpngOutput format: png or jpg
width800Render width in pixels; the height grows with the content
baseUrlOptional base URL for resolving relative asset links in the HTML

Use the sample request above to render an image from your own tooling.