Skip to content

HTML to Image

Native tool that converts an HTML/CSS snippet into a rasterized image (PNG, JPEG, or WebP). The agent writes the HTML and receives the rendered image back.

  • Social posts with consistent layout.
  • Product cards, coupons, banners, visual receipts.
  • Creatives with typography, gradients, and exact layout — when you want pixel control, not a generative model.
  • Dynamic templates: HTML with variable data filled by the agent.

Unlike Generate Image (generative model), here the result is deterministic: same HTML, same image.

  1. In the agent’s Tools tab, click + Add Tool.
  2. Under NATIVE TOOLS, pick HTML to Image.
  3. Optionally, set defaults for the parameters:
    • html: default HTML/CSS (rare to set here — usually the AI decides).
    • width: default width in pixels.
    • height: default height in pixels.
    • format: webp, png, or jpeg.
  4. Each parameter can be left as Auto (AI decides per call) or set to Manual with a fixed value.
  5. Click Save.

Setting manual defaults is useful when you want to lock a format (for example, always 1080x1080 webp for Instagram posts) and not let the AI choose.

The agent decides to call this tool when the prompt guides it or when the user asks for something visual with specific format (“a 1080x1080 card with title X and subtitle Y”).

The agent composes the HTML internally — you don’t have to provide a template. The more specific the agent prompt about style, palette, and structure, the more consistent the result.

  • Simple HTML works best. External images, web fonts, and scripts may not load. Prefer inline styles and system fonts.
  • Deterministic result. Same HTML produces the same image — good for standardization, bad for creative variation.
  • No image model cost. Since it doesn’t use generative AI, the cost is only the prompt the agent spends generating the HTML.
  • Sensible sizes. Very high width/height (above ~2000px) can increase latency.