A high-performance HTML to PNG renderer using Playwright and headless Chrome. This tool is optimized for batch rendering thousands of frames at high speed (30+ FPS) with minimal overhead.
- Efficient HTML to PNG rendering
- Support for complex CSS, fonts, and transparency
- Batch processing capabilities
- Asynchronous operation for optimal performance
- Minimal overhead for high-throughput rendering
- Create and activate the conda environment:
conda env create -f environment.yml
conda activate fast-html-renderer- Install Playwright and its dependencies:
playwright install chromiumBasic example:
import asyncio
from fast_html_renderer import render_html_to_png
html = "<html><body style='font-family:sans-serif;color:white;background:transparent;'><h1>Hello, World!</h1></body></html>"
asyncio.run(render_html_to_png(html, "output.png"))Batch rendering example:
import asyncio
from fast_html_renderer import batch_render
html_frames = [
f"<div style='font-size:50px;color:white;'>Frame {i}</div>"
for i in range(1000)
]
asyncio.run(batch_render(html_frames))- Capable of rendering at 30+ FPS
- Optimized for batch processing thousands of frames
- Minimal overhead through browser instance reuse
- Efficient memory usage through proper resource management
- Python 3.8+
- Playwright
- Chromium (installed automatically by Playwright)