---
canonical_url: "https://docs.composio.dev/toolkits/htmlcss_to_image"
markdown_url: "https://docs.composio.dev/toolkits/htmlcss_to_image.md"
product: "platform"
version: null
last_updated: null
---

# HTML/CSS to Image

HTML/CSS to Image converts HTML, CSS, public web pages, and reusable templates into images and PDFs through an API.

- **Category:** images & design
- **Auth:** API_KEY
- **Composio-managed OAuth available?** N/A
- **Tools:** 10
- **Triggers:** 0
- **Slug:** `HTMLCSS_TO_IMAGE`
- **Version:** 20261014_01
- **Instant:** Supported on the latest version. Support varies by tool.

## Tools

### Create Image

**Slug:** `HTMLCSS_TO_IMAGE_CREATE_IMAGE`

Create a hosted image from HTML/CSS or an internet-reachable webpage, including authenticated pages using request headers. Returns an image ID and a hosted URL accessible to anyone who has that URL.

**Instant:** Supported on the latest version.

**Instant pricing:** $0.014 per render credits

**Discount:** 57

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `css` | string | No | CSS applied to supplied HTML or injected into a captured webpage. |
| `url` | string | No | Absolute, internet-reachable HTTP(S) webpage URL to capture. Set this or html, but not both; use headers for authenticated pages. |
| `html` | string | No | HTML to render. Set this or url, but not both. |
| `headers` | object | No | HTTP headers sent to the captured page, with at most 20 case-insensitive names. |
| `ms_delay` | integer | No | Extra render delay in milliseconds, from 0 to 10000. Zero omits the explicit delay. |
| `selector` | string | No | CSS selector for the element to capture. |
| `timezone` | string | No | IANA timezone exposed to the rendered page. |
| `media_type` | string ("screen" | "print") | No | CSS media type used while rendering: screen or print. |
| `full_screen` | boolean | No | Capture the full scrollable page instead of only the viewport. |
| `max_wait_ms` | integer | No | Maximum wait from 500 to 10000 milliseconds for page loading. |
| `color_scheme` | string ("light" | "dark") | No | Preferred browser color scheme: light or dark. |
| `device_scale` | number | No | Device scale factor from 0.1 to 3. |
| `google_fonts` | array | No | Google Font family names to load while rendering. |
| `viewport_width` | integer | No | Viewport width in pixels, from 1 to 6000. Requires viewport_height. |
| `viewport_height` | integer | No | Viewport height in pixels. Requires viewport_width. |
| `dedupe_duration_s` | integer | No | Reuse a matching recent render for this many seconds. Allowed durations depend on the account plan; free accounts accept 0 or 2592000 (30 days). |
| `render_when_ready` | boolean | No | Wait until the page signals that rendering is ready. |
| `block_consent_banners` | boolean | No | Attempt to block common consent banners. |
| `transparent_background` | boolean | No | Render a transparent background where supported. |
| `additional_header_origins` | array | No | Up to 20 unique exact HTTP(S) origins that may also receive headers. |
| `include_headers_on_subrequests` | boolean | No | Also include supplied headers on page subrequests. |

#### Output

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `data` | string | Yes | Data from the action execution |
| `error` | string | No | Error if any occurred during the execution of the action |
| `successful` | boolean | Yes | Whether or not the action execution was successful or not |

### Create Image from Template

**Slug:** `HTMLCSS_TO_IMAGE_CREATE_IMAGE_FROM_TEMPLATE`

Create an image from a reusable template using the latest version or an explicitly selected version.

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `template_id` | string | Yes | Template ID from LIST_TEMPLATES or CREATE_TEMPLATE. |
| `template_values` | object | Yes | Values supplied to the template's Handlebars variables. |
| `template_version` | integer | No | Specific version to render; omit to use the latest version. |

#### Output

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `data` | string | Yes | Data from the action execution |
| `error` | string | No | Error if any occurred during the execution of the action |
| `successful` | boolean | Yes | Whether or not the action execution was successful or not |

### Create Images Batch

**Slug:** `HTMLCSS_TO_IMAGE_CREATE_IMAGES_BATCH`

Create 1 to 25 hosted images from HTML/CSS or internet-reachable webpages in one request, including authenticated pages using shared or per-image headers. Requires an account plan that supports batch creation.

**Instant:** Supported on the latest version.

**Instant pricing:** $0.014 per render credits

**Discount:** 57

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `variations` | array | Yes | One to 25 image requests; each overrides matching default_options fields. |
| `default_options` | object | No | Shared render settings applied before each variation's overrides. |

#### Output

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `data` | string | Yes | Data from the action execution |
| `error` | string | No | Error if any occurred during the execution of the action |
| `successful` | boolean | Yes | Whether or not the action execution was successful or not |

### Create Template

**Slug:** `HTMLCSS_TO_IMAGE_CREATE_TEMPLATE`

Create a reusable Handlebars HTML/CSS image template. WARNING: the template is persistent because the API exposes no delete operation, and a free account can hold only one template.

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `css` | string | No | CSS applied to the template. |
| `html` | string | Yes | Handlebars HTML for the reusable template. |
| `name` | string | No | Template name, at most 64 characters. |
| `description` | string | No | Template description, at most 1024 characters. |
| `render_options` | object | No | Optional free-tier render settings for this template. |

#### Output

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `data` | string | Yes | Data from the action execution |
| `error` | string | No | Error if any occurred during the execution of the action |
| `successful` | boolean | Yes | Whether or not the action execution was successful or not |

### Delete Image

**Slug:** `HTMLCSS_TO_IMAGE_DELETE_IMAGE`

Permanently delete one generated image and clear its HCTI CDN cache. Copies previously written to external storage are not deleted.

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `image_id` | string | Yes | Image ID to permanently delete. |

#### Output

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `data` | string | Yes | Data from the action execution |
| `error` | string | No | Error if any occurred during the execution of the action |
| `successful` | boolean | Yes | Whether or not the action execution was successful or not |

### Delete Images Batch

**Slug:** `HTMLCSS_TO_IMAGE_DELETE_IMAGES_BATCH`

Permanently delete multiple generated images and clear their HCTI CDN caches. Copies previously written to external storage are not deleted.

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `image_ids` | array | Yes | Non-empty list of image IDs to permanently delete. |

#### Output

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `data` | string | Yes | Data from the action execution |
| `error` | string | No | Error if any occurred during the execution of the action |
| `successful` | boolean | Yes | Whether or not the action execution was successful or not |

### Get or Transform Image

**Slug:** `HTMLCSS_TO_IMAGE_GET_IMAGE`

Download a generated image by ID, optionally converting its format, resizing it, or cropping it.

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `dpi` | integer | No | Output DPI from 30 to 600, primarily for PDF output. |
| `width` | integer | No | Output width in pixels, up to 5000. |
| `format` | string ("png" | "jpg" | "webp" | "pdf") | No | Output file format. Defaults to PNG when omitted. |
| `height` | integer | No | Output height in pixels, up to 5000. |
| `crop_top` | string | No | Top crop coordinate or percentage. |
| `image_id` | string | Yes | Generated image ID returned by an image creation tool. |
| `x_origin` | string ("start" | "center" | "end") | No | Horizontal origin used for aspect-ratio cropping. |
| `y_origin` | string ("start" | "center" | "end") | No | Vertical origin used for aspect-ratio cropping. |
| `crop_left` | string | No | Left crop coordinate or percentage. |
| `crop_right` | string | No | Right crop coordinate or percentage. |
| `crop_width` | string | No | Crop width as a pixel coordinate or percentage. |
| `crop_bottom` | string | No | Bottom crop coordinate or percentage. |
| `crop_height` | string | No | Crop height as a pixel coordinate or percentage. |
| `aspect_ratio` | string | No | Crop aspect ratio in width_height form, such as 16_9. |

#### Output

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `data` | string | Yes | Data from the action execution |
| `error` | string | No | Error if any occurred during the execution of the action |
| `successful` | boolean | Yes | Whether or not the action execution was successful or not |

### Get Usage

**Slug:** `HTMLCSS_TO_IMAGE_GET_USAGE`

Return recent hourly, daily, monthly, and billing-period image usage for the connected account.

#### Output

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `data` | string | Yes | Data from the action execution |
| `error` | string | No | Error if any occurred during the execution of the action |
| `successful` | boolean | Yes | Whether or not the action execution was successful or not |

### List Templates

**Slug:** `HTMLCSS_TO_IMAGE_LIST_TEMPLATES`

List reusable image templates owned by the connected account, including their current version, source, and render settings.

#### Output

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `data` | string | Yes | Data from the action execution |
| `error` | string | No | Error if any occurred during the execution of the action |
| `successful` | boolean | Yes | Whether or not the action execution was successful or not |

### Update Template

**Slug:** `HTMLCSS_TO_IMAGE_UPDATE_TEMPLATE`

Create a new version of an existing template using replacement Handlebars HTML and optional CSS or render settings.

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `css` | string | No | CSS for the new template version. |
| `html` | string | Yes | Replacement Handlebars HTML for the new template version. |
| `name` | string | No | Template name, at most 64 characters. |
| `description` | string | No | Template description, at most 1024 characters. |
| `template_id` | string | Yes | Existing template ID from LIST_TEMPLATES or CREATE_TEMPLATE. |
| `render_options` | object | No | Optional free-tier render settings for the new template version. |

#### Output

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `data` | string | Yes | Data from the action execution |
| `error` | string | No | Error if any occurred during the execution of the action |
| `successful` | boolean | Yes | Whether or not the action execution was successful or not |
