Render HTML to image
html_to_imageRender an HTML string or HTTP(S) URL with headless Chromium and save a screenshot, with viewport sizing, full-page capture, CSS selectors, and multiple image formats.
Instructions
Render an HTML string or HTTP(S) URL with headless Chromium and save a screenshot. Supports viewport size, full-page capture, element selectors, device scale factor and multiple output formats. Requires a local Chrome/Chromium (auto-detected or IMG_CHROME_PATH).
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "html_to_image"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| url | No | HTTP(S) page URL to screenshot. Mutually exclusive with html. | |
| html | No | HTML document or fragment to render. Mutually exclusive with url. | |
| width | No | Viewport width in CSS pixels. Defaults to 1280. | |
| height | No | Viewport height in CSS pixels. Defaults to 800. | |
| quality | No | Encoder quality (1-100). Applies to JPEG, WebP, AVIF and TIFF output. | |
| wait_ms | No | Extra delay before capture, in milliseconds. | |
| base_url | No | Base URL used to resolve relative resources in an HTML string. | |
| lossless | No | Use lossless encoding where supported (WebP and AVIF). | |
| selector | No | Optional CSS selector. When provided, only the first matching element is captured. | |
| file_name | No | Optional base file name; path separators are not allowed. The actual image format determines the extension. When multiple outputs are produced, -1, -2, ... suffixes are appended. Existing files are never overwritten. | |
| full_page | No | Capture the full scrollable page instead of the viewport. | |
| background | No | Page background color applied before capture, for example #ffffff. By default the page's own background is kept; JPEG output is flattened onto white unless specified. | |
| output_dir | No | Absolute directory where the output file is saved. Defaults to IMG_OUTPUT_DIR, or ~/img-output. The directory is created automatically. | |
| timeout_ms | No | Navigation and selector timeout in milliseconds. | |
| wait_until | No | Navigation readiness state. Defaults to load. | load |
| output_format | No | Output format. Defaults to PNG. | png |
| compression_level | No | PNG compression level (0-9); higher is smaller and slower. | |
| device_scale_factor | No | Device pixel ratio; 2 renders at twice the pixel dimensions. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| image | Yes | ||
| details | No | ||
| operation | Yes |