view source

muvon/html-render

tool

html-render - renders HTML to PNG or JPEG at several platform sizes in headless Chromium, with layout checks; shipped with this tap, needs Node

html-render — the tap's HTML-to-image renderer. It opens an HTML file or URL in headless Chromium at each requested size, waits for fonts, images and network, and writes PNG or JPEG files at a device scale factor of 2 by default (a 1080x1350 size gives a 2160x2700 file). With --each it writes one file per matching element, which exports a carousel from a single HTML file. Per size it also checks the layout: text clipped by a box, text outside the canvas, broken images, overlapping text, fallback fonts and low contrast. It exits 1 when any error is found, and still writes the files. The installer links the html-graphics skill's scripts/render.mjs onto PATH and installs Playwright with Chromium through microsoft/playwright-chromium. Node.js 18+, no npm packages of its own.

Key Commands

CommandDescription
html-render shot ad.html -o out --size 1080x1080 --size 1080x1920One PNG per size, named ad-1080x1080.png and so on
html-render shot carousel.html -o out --size 1080x1350 --each .slideOne PNG per .slide element
html-render shot card.html -o out --size 1200x630 --format jpeg --quality 90JPEG output
html-render shot logo.html -o out --size 512x512 --transparentPNG with a transparent background
html-render shot https://example.com -o out --size 1280x800 --style '#cookie{display:none} .email{filter:blur(8px)}'Inject CSS before the checks and the screenshot, to hide a banner or blur personal data on a captured page
html-render shot ad.html -o out --size 1080x1080 --no-checkSkip the layout checks
html-render --helpEvery option

Common Usage

bash
html-render shot graphics-out/launch/src/ad.html -o graphics-out/launch \
  --size 1080x1080 --size 1080x1350 --size 1080x1920 --size 1200x630

Findings print one per line as ERROR|WARN <size> <check>: <text> (<detail>).