# HTML to Image

HTML to Image is a service that converts HTML and CSS into images or captures screenshots of web pages.

- **Category:** images & design
- **Auth:** API_KEY
- **Composio Managed App Available?** N/A
- **Tools:** 3
- **Triggers:** 0
- **Slug:** `HTML_TO_IMAGE`
- **Version:** 20260316_00

## Tools

### Check HTML-to-Image Account Usage

**Slug:** `HTML_TO_IMAGE_CHECK_USAGE`

Attempts to retrieve account usage statistics from the HTML-to-Image API by trying multiple common endpoint patterns. NOTE: The html2img.com API does not officially document a dedicated usage statistics endpoint. This action tries several plausible endpoint paths and returns empty usage data if none are found (when return_defaults_on_error=true). For actual usage tracking with html2img.com, monitor the 'credits_remaining' field returned in responses from the convert or screenshot endpoints. Returns hourly, daily, and monthly image creation counts if a usage endpoint exists, or empty statistics as a fallback.

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `endpoint_paths` | array | No | Optional custom endpoint paths to try for usage statistics (e.g., ['/v1/usage', '/api/stats']). Supports both relative paths (e.g., '/v1/usage') and fully-qualified URLs (e.g., 'https://api.example.com/usage'). If not provided, the action tries built-in candidates: /v1/usage, /api/usage, /v1/account/usage, /api/account/usage. |
| `return_defaults_on_error` | boolean | No | If true (default), returns empty usage statistics when no endpoint is found or all endpoints fail. If false, raises an error with details about which endpoints were tried. Recommended to keep as true for graceful handling when the API provider doesn't support usage endpoints. |

#### 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 |

### Convert HTML to Image

**Slug:** `HTML_TO_IMAGE_CONVERT_TO_IMAGE`

Tool to convert HTML content into an image. Returns either a downloadable file or a JSON payload containing id and url, depending on the upstream API behavior.

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `html` | string | Yes | HTML content to render into an image |
| `width` | integer | No | Width of the output image in pixels; must be >=1 Maximum enforced limit may apply; exceeding it can cause validation errors or silent downscaling. |
| `height` | integer | No | Height of the output image in pixels; must be >=1 Maximum enforced limit may apply; exceeding it can cause validation errors or silent downscaling. |

#### 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 HTML to Image

**Slug:** `HTML_TO_IMAGE_GET_IMAGE`

Retrieve a previously generated image by its URL. Use this to fetch, resize, or download an existing HTML-to-image asset. The image URL is typically obtained from the 'url' field of the HTML_TO_IMAGE_CONVERT_TO_IMAGE response.

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `dl` | integer ("0" | "1") | No | Set to 1 to serve the image as a downloadable attachment. |
| `dpi` | integer | No | Optional DPI metadata for the image; maximum 600. |
| `width` | integer | No | Optional output width in pixels; maximum 5000. |
| `height` | integer | No | Optional output height in pixels; maximum 5000. |
| `image_id` | string | Yes | Full URL of the generated image (e.g., 'https://i.html2img.com/image-1234567890-123456.png'), typically obtained from the 'url' field of the HTML_TO_IMAGE_CONVERT_TO_IMAGE response. You may also provide just a partial path or append .png, .jpg, or .webp to select the format. |

#### 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 |
