Last updated: June 08, 2026 · Updated quarterly to reflect current pricing and features.
How-To · Deprecated Headless Browser
Using PhantomJS for HTML-to-Image Rendering: A Complete Guide
June 08, 2026
5 min read
Deprecated Headless Browser
A practical guide to using PhantomJS for HTML-to-image rendering — from initial setup to production considerations, with honest notes on where the DIY approach breaks down.
Setting up PhantomJS for HTML-to-image rendering
PhantomJS is a deprecated headless browser that can handle HTML-to-image conversion. Here's the practical setup guide — plus an honest assessment of where it falls short in production.
Installation and setup
# Install PhantomJS
npm install phantomjs
# or for Python:
pip install phantomjs
Basic usage
// Render HTML to PNG with PhantomJS
const browser = await phantomjs().launch();
const page = await browser.newPage();
await page.setContent('<h1>Hello World</h1>');
await page.screenshot({ path: 'output.png' });
await browser.close();
Production considerations
- Memory management — headless browsers use 300-500MB+ of RAM
- Cold starts — first render after idle takes 2-5 seconds
- Concurrency — managing multiple simultaneous renders requires a pool
- Deployment — Chromium on serverless platforms requires special configuration
When a managed API makes more sense
Self-hosting PhantomJS makes sense at high volume with engineering resources available. For most projects — especially automation workflows — a managed API removes all the infrastructure overhead:
# One API call. That's all.
curl -X POST https://renderpix.dev/v1/render \
-H "X-API-Key: YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{
"html": "<div style=\"width:1200px;height:630px;background:#0f0f0f;color:#fff;display:flex;align-items:center;justify-content:center;font-size:48px\">Hello, RenderPix</div>",
"width": 1200, "height": 630, "format": "png"
}' --output card.png
| Feature | PhantomJS | RenderPix |
| Starting price | Free | $9/mo |
| Free tier | unlimited | 100 renders/mo |
| Raw HTML input | ✓ | ✓ Full HTML/CSS |
| n8n native node | ✗ | ✓ Native node |
| Batch rendering | ✗ | ✓ Built-in |
| Template variables | ✗ | ✓ {key} syntax |
| Async callback | ✗ | ✓ |
| PNG / JPEG / WebP | ✓ | ✓ |
| Primary use case | Legacy headless rendering | HTML image generation |
Try RenderPix free — no credit card needed
100 renders/month on the free plan. Full HTML control. Native n8n node.
Get your free API key →
More about PhantomJS
Compare other tools