← data exports  /  apify actor

HTML to Image Converter: Convert HTML to PNG, JPG and WEBP

how to get the data with our Apify actor html-to-image

Render an HTML snippet to a PNG, JPEG or WEBP image at any width, with retina scaling and transparent background. Batch mode: process up to 1000 items per run.

on apify
v0iddo/html-to-image
category
developer tools, automation
build
0.1.7, built 2026-10-26
billing
Apify bills it per result; the price for your plan is on the actor's page.

What you get

Each processed item adds one row to the dataset with file_url (a link to the generated file in the run's key-value store), filename, mime, bytes, credits and ms. The file itself is stored under the key shown in file_key. A failed item adds a row with error and status instead; the run fails only when every item failed.

The main fields of each row:

  • # (index)
  • File (file_url)
  • File name (filename)
  • Type (mime)
  • bytes
  • credits
  • Time (ms) (ms)

Run it on Apify

  1. Open html-to-image on Apify and sign in, or make an Apify account.
  2. On the Input tab, fill in the fields listed below. The form opens with example values filled in.
  3. Click Start. Rows appear on the Output tab while the run works.
  4. Export the rows as JSON, CSV, Excel, XML or HTML, or read them through the Apify API.
  5. To run it again on a schedule, save the input as a task and add a schedule in the Apify Console.

What you can set

  • HTML (html, required): The HTML document or fragment (UTF-8, up to 2 MB). JavaScript is not executed.
  • Width (width): Viewport width in CSS px. Default: 1200.
  • Height (height): Viewport height in CSS px; omit for a full-page image that fits the content.
  • Output format (format): File format of the result. Options: PNG, JPEG, JPG, WEBP. Default: png.
  • Quality (quality): jpeg / webp quality. Default: 90.
  • Device Scale Factor (device_scale_factor): Pixel density (2 = retina) (a number)
  • Transparent (transparent): Transparent page background (png / webp only) Default: false.
  • Batch items (items): Optional. A list of input objects with the same fields as above; every object is processed in its own right and the top-level fields act as shared defaults. Leave empty to process the single input above (up to 1000 items per run).

Example input

This is the input the actor is tested with every day.

example inputjson
{
  "html": "<div style='font:700 48px sans-serif;padding:40px;background:#1fa37a;color:#fff'>Hello, v&oslash;iddo</div>",
  "width": 600,
  "height": 200
}

Run it from Python

The official apify-client package starts the run, waits for it and reads the rows. It needs your own Apify API token.

needs your own Apify tokenpython
# pip install apify-client
from apify_client import ApifyClient

client = ApifyClient("YOUR_APIFY_TOKEN")  # your own API token, from the Apify Console
run_input = {
    "html": "<div style='font:700 48px sans-serif;padding:40px;background:#1fa37a;color:#fff'>Hello, v&oslash;iddo</div>",
    "width": 600,
    "height": 200,
}
run = client.actor("v0iddo/html-to-image").call(run_input=run_input)
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item)

Limits

  • Up to 30 seconds per item.
  • Input size up to 2,100,000 bytes per item.
  • URLs must be public http(s) addresses; private and local addresses are refused, robots.txt is respected where pages are fetched.
  • No logins, no captcha solving, no personal-data lookups.
  • Each run sends one short usage record to the developer: the Actor and run IDs, the number of results, whether the run succeeded (and if not, the kind of error, such as "blocked" or "input problem"), whether the account is on a paid Apify plan, how the run was started (for example from the Console, the API or a schedule) and a one-way fingerprint of the account (a hash, not the account ID), so that repeat runs of one account count once. It contains nothing from your input or results.

Questions

Do I need an account or an API key?

No key of your own. You only need an Apify account to start the actor.

How many items can one run process?

One item from the fields above, or up to 1,000 in items (batch mode). Each item becomes one row in the dataset.

Where are the results?

Every row links to its file (file_url) in the run's key-value store; the rows themselves export as JSON, CSV or Excel from the Output tab or the API.

Can I run it on a schedule or from another tool?

Yes. Save the input as a task and schedule it in the Apify Console, or start it from Make, Zapier, n8n, a webhook or the API calls above.

More

every fact here is read from the actor's public data on Apify, every day; it last changed on