HTML templates

HTML to image: pixel-exact layouts and reusable templates

When text and layout must be exact, generate nothing: render it. PlugMuse does HTML to image rendering in a real headless browser, so your agent can turn HTML and CSS into a PNG, save the layout as a template with tokens, and render variants in several sizes.

  • Real headless Chromium with Tailwind built in
  • Web fonts, inline images and transparent PNGs
  • Templates with tokens, sections and named sizes

How HTML to image rendering works

render_html_image sends your page to Cloudflare Browser Rendering, waits until the network is idle so fonts and images have loaded, and captures it at the width and height you set. The PNG is saved in your library. Tailwind utility classes work without adding any script, and the full CSS surface is available: grid, flexbox, gradients, filters, masks and variable fonts.

Images and fonts go in as tokens: write {{photo}} in the HTML and list the token with a public URL. transparent_background keeps unused pixels transparent, which is what you want for a logo or a copyright mark laid over other media.

When to use HTML to image instead of generation

Image models are great at pictures and weak at exact words. Use HTML to image when the copy must be letter-perfect, when alignment follows a brand grid, for certificates, quote cards, data-driven graphics, or when you supply HTML yourself. A poster or banner request alone still goes to image generation; the agent only picks HTML rendering when you ask for it or the job needs exact layout.

Templates, tokens and sizes

create_template saves a layout with parameters of type text, image_url, color, number or boolean. Booleans can show or hide blocks with {{#name}}…{{/name}} and {{^name}}…{{/name}}. Named sizes (for example square and story) render the same HTML at different dimensions, each with its own body class for per-size CSS. render_template fills the tokens for up to four variants per call; text values are escaped, and each image costs 1 credit.

Generative templates are also possible: a prompt with tokens, a model, default settings and reference images, where each variant becomes its own image or video job.

ToolUse
render_html_imageOne-off HTML to image render
create_template / update_templateSave or change a reusable layout or prompt
list_templatesFind templates by name
render_templateRender variants and sizes from a template

Common HTML to image jobs

Teams use HTML to image rendering for Open Graph cards for every blog post, quote graphics for social media, certificates and badges, event banners with exact dates, pricing cards, charts and data snapshots, and watermark graphics with transparent backgrounds. Because the layout is code, one template can produce hundreds of consistent images by changing only the values.

Developers like HTML to image in their agent because they can write the layout in the same tools they use for the website and keep the template in sync with the site’s design.

Writing HTML that renders cleanly

Size the root element to the output exactly, load fonts explicitly, and avoid content that depends on the current time or randomness. Use tokens for everything that changes, and give text parameters sensible defaults. For several sizes, keep one HTML body and add per-size rules with the body class. Check one render before rendering a batch.

Example: Open Graph cards for every blog post

You want a matching social card for each blog post. The agent writes a 1200×630 HTML layout with your brand font, the post title as a text token, an optional cover image token and a boolean token that shows a "New" badge. It saves the layout as a template and renders the first card for you to check. After one tweak to the line height, it renders cards for the next ten posts in a few calls. HTML to image keeps the titles letter-perfect, which generated images cannot promise.

When the brand changes its typeface or colors, updating the template once and re-rendering brings every card up to date. Because each render is a fresh capture of the same HTML, there is no drift between cards made months apart, which keeps a blog archive or a certificate series visually consistent without manual design work.

What you get back

Each render returns a PNG at a permanent link, at exactly the size you set and with a transparent background when you ask for one. Saved templates keep their HTML, tokens, defaults and sizes on your account, and list_templates shows them all, so any later conversation can render new values without rewriting the layout. Each rendered set can be named and tagged by campaign, variant and size, which keeps large sets easy to search.

Step by step

Render your first layout with HTML to image

  1. Ask for HTML/CSS rendering or paste your HTML.
  2. Set the output size and list any images or fonts as tokens.
  3. The agent calls render_html_image and checks the PNG.
  4. Fix layout issues in the HTML rather than describing them away.
  5. Save the layout as a template to render variants later.

Try it

Requests to try

  • Render this HTML card at 1200×630 with Inter from Google Fonts.
  • Make a transparent PNG of "© Acme 2026" in white bold type for a video watermark.
  • Save a quote-card template with tokens for quote, author and photo.
  • Render the template for these four quotes in square and story sizes.
  • Build a certificate layout with the recipient’s name as a token.

FAQ

Questions and answers

Does HTML to image support JavaScript?

Yes, pages run in a real browser; the capture happens once the network is idle.

Can I use my own fonts?

Yes, with <link>, @import or @font-face; a font file can be passed as a token.

How much does a render cost?

1 credit per image.

Are template names unique?

Yes, per account and case-insensitive, so you can render by name.

What happens if one variant fails?

The whole job fails and is refunded, so you are never charged for a partial set.

Is HTML to image rendering free?

Each image costs 1 credit.

Can templates use images from my library?

Yes. Pass the asset URL as an image_url value.

Which file format does HTML to image produce?

PNG files, which keep text sharp and support transparent backgrounds.

Can HTML to image render several sizes from one template?

Yes. Define each size once in the template and render them together.

Can I preview a template before saving it?

Yes. Render the HTML once with render_html_image, then save it when you are happy.

Can HTML to image make transparent PNGs?

Yes. Set transparent_background and keep the canvas tight around the visible text or logo.

Do I need to know HTML?

No. Describe the layout and the agent writes the HTML; you only review the result.

Connect in a minute. Start with 20 free credits.

Add the MCP server URL to your AI agent and generate images, video and audio from your first chat.