Skip to main content

Quick Start

Installation

1. Install Dependencies

uv sync

2. Install Browser

uv run playwright install chromium

You can also install Firefox or WebKit:

uv run playwright install firefox
uv run playwright install webkit

3. Start Converting

uv run html2png convert input.html -o output.png

Your First Conversion

CLI Usage

# Convert a single file
html2png convert page.html -o output.png

# Convert a URL
html2png convert https://example.com -o screenshot.png

# Use pipe input
cat page.html | html2png convert - -o output.png

Python API

import html2png

# Simple usage
html2png.render("page.html", "output.png")

# With parameters
html2png.render("page.html", "output.png", width=1920, height=1080, dpr=2.0)

What's Next?