Skip to main content

Capture a PNG screenshot of a local HTML presentation using Playwright

Project description

html-snapshot

Capture a PNG screenshot from a local HTML presentation using Playwright.

Quick start

# one-time: install Playwright browser assets
uvx playwright install chromium

# run the script with uvx
uvx --with playwright python html_snapshot.py /path/to/slide.html --output slide.png

Once the package is published to PyPI you can install it and use the console entry point:

pip install html-snapshot
html-snapshot /path/to/slide.html --output slide.png

CLI options

Option Description
html_path Path to the local HTML file to render
-o / --output Output PNG path (default: same as input with .png suffix)
--width / --height Viewport size (default: 1400×900)
--delay Seconds to wait after load before capturing
--no-full-page Capture only the viewport instead of the full page

Development

uv venv           # optional: create a local env for hacking
uv pip install -r requirements.txt  # not necessary if using uvx

For remote execution, the script can be invoked directly from this GitHub repo:

uvx --with playwright python gh:oneryalcin/html-snapshot/html_snapshot.py sample.html

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

html_snapshot-0.1.0.tar.gz (3.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

html_snapshot-0.1.0-py3-none-any.whl (4.1 kB view details)

Uploaded Python 3

File details

Details for the file html_snapshot-0.1.0.tar.gz.

File metadata

  • Download URL: html_snapshot-0.1.0.tar.gz
  • Upload date:
  • Size: 3.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.7.5

File hashes

Hashes for html_snapshot-0.1.0.tar.gz
Algorithm Hash digest
SHA256 7fbbc61c41c525496dcc40c8b6cc9207e3fa7564562c379f0fd9a684441ec6d7
MD5 d3c5c5c2ea26b6ea26beab4efe4e7bf0
BLAKE2b-256 f933b3f75cb487e79fbf39f77397384ede2402471540f32772350cafffb2cbc9

See more details on using hashes here.

File details

Details for the file html_snapshot-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for html_snapshot-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 458ccc7b5e45b5a0ad24516af787bf3ca5e4a893c286f5010e4714f7a709bbdb
MD5 3361dfc8f10c2a270142214bd64eba84
BLAKE2b-256 6644677c24a7abc6b342b75eea5bb8d42cf006519cc085ae35c7fecc5a686161

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page