Draw HTML as an image
html_to_imageDraw a page of HTML and CSS as a PNG, JPEG or WebP picture: social cards, badges, receipts, mockups, diagrams in SVG. The page is drawn by Chromium with no script and no network access, so inline CSS, SVG and data: pictures and fonts work and anything fetched from an address does not. width and height are the page's size in CSS pixels; scale 2 makes a sharper picture; full_page draws a long page to its end. Returns a download URL valid for one hour.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| html | Yes | The page: a full HTML document or a fragment, with its CSS in a style element. At most 2 MB. | |
| scale | No | Pixels per CSS pixel. Default 1. | |
| width | No | Page width in CSS pixels. Default 1280. | |
| format | No | Default png. | |
| height | No | Picture height in CSS pixels (the smallest height with full_page). Default 720. | |
| quality | No | For jpeg and webp. Default 85. | |
| full_page | No | Draw the whole page, up to 16,000 pixels tall. | |
| transparent | No | Leave areas the page does not paint see-through (PNG and WebP). |