Overview
Write a template in HTML, publish it, and generate images by passing variables to the API
How it works
imgrender uses declarative image generation: you describe the template with familiar HTML and CSS, publish it, and pass variables through the API. imgrender renders that into a high-quality image.
<div
style="
width: 400px;
height: 200px;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
display: flex;
align-items: center;
justify-content: center;
"
>
<h1 style="color: white; font-size: 32px">Hello imgrender</h1>
</div>The code above generates a 400×200 pixel image with a gradient background and centered white text.
Template editor
The template editor is imgrender's online editing environment. It is useful for checking a template quickly before you write documentation or call the API.
In the template editor you can:
- Edit HTML and preview the render in real time
- Configure output parameters such as image size and format
- Manage and preview the fonts in use
- Start from a built-in template and quickly adapt it to your own style
- Parameterize the template with variables so one template can generate different images
- Open the API debug panel in one click and build a callable render request from the saved template
- Share the current editing state with a URL so others can collaborate or reproduce it
Recommended workflow
When building a template, finish the layout and styling in the template editor first. After the result looks right, connect the Generate image from template API.
Core concepts
Image generation in imgrender works like this:
- Structure - Use HTML to define the element hierarchy
- Styling - Control appearance with CSS properties or Tailwind CSS
- Variable substitution - Parameterize content with
{$ name $}placeholders, which are replaced with real values at render time - Rendered output - imgrender renders the template and exports an image in the requested format
Compared with traditional image generation
| Approach | Advantages | Disadvantages |
|---|---|---|
| imgrender | Code is the image: easy to maintain, simple to call, version control, and dynamic generation | Requires learning |
| Design-tool export | WYSIWYG, no coding required | Hard to generate in bulk and hard to change |
| Canvas API | Highly flexible | Complex code, costly to maintain, and depends on a JS runtime |
HTML and CSS support
imgrender's rendering engine does not fully follow browser standards. It supports a subset of HTML and CSS.
Rendering differences
imgrender does not guarantee that a render matches the browser exactly. Test it in the template editor.
HTML element limits
imgrender accepts only static HTML fragments and does not run JavaScript. For dynamic content, use template variables, conditions, and loops.
Only a limited set of static, visible elements is supported:
- ✅ Supported: basic elements such as
div,span,p, andimg - ❌ Not supported:
<input>,<style>,<link>,<script>, and similar elements. Do not send a full HTML document. Send only the core fragment.
CSS property limits
For the CSS properties imgrender supports, see Supported styles.
Next steps
Read the docs below for more detail on what you need:
- Template editor - Edit a template online and preview the render in real time
- Variables - Use template variables, filters, conditions, and loops so a template can be reused
- Style - Control appearance with inline styles and Tailwind CSS
- Layout - Flexbox, Grid, and the box model
- Typography and fonts - Fonts, whitespace, line breaks, and other text handling
- Load images - Embed external images in a generated image
Ready to start?
If you already know the basics, try it in the template editor, or go straight to the Generate image from template API and start using it.