Skip to content
html2shot logo

html2shot

Screenshot any HTML element in the browser

Turn any part of a web page into a PNG, JPEG, WebP, SVG or canvas, right in the visitor's browser.
A faster, more accurate html2canvas alternative with a compatible API. No server, no dependencies.

PNG · JPEG · WebP · SVG · html2canvas API · web fonts · shadow DOM · Chrome, Safari, Firefox

GitHub · npm · 🌐 Live demo

🧰 Projects

html2shot
Screenshot any element to an image. The browser does the drawing, so modern CSS, web fonts, SVG, shadow DOM and form values come out right. It had the best score of six libraries in Chrome, Safari and Firefox in our benchmark, and works as a drop-in replacement for html2canvas.

toimage
Turn an SVG, canvas, <img>, video, Blob or URL into a PNG, JPEG or WebP at any size, sharp, in one call. With html2shot it does HTML elements too.

🚀 Use it in one minute

You want Code
Install npm install html2shot
A PNG of an element await toPng(element)
A sharper image await toPng(element, { scale: 2 })
A file to upload or copy to the clipboard await toBlob(element)
Replace html2canvas import html2canvas from 'html2shot'
No build step <script src="https://cdn.jsdelivr.net/npm/html2shot@1"></script>

🤝 Contribute

Found a page that renders wrong? Report it with a small HTML snippet, the browser, and a screenshot of the page and of html2shot's output. Speed-ups and framework recipes are welcome too, see CONTRIBUTING.md.

💖 Support

html2shot is free and always will be. ⭐ Star the repo to follow new releases, or become a sponsor to keep screenshots accurate as browsers change.

Code: MIT

Popular repositories Loading

  1. html2shot html2shot Public

    Screenshot any HTML element to PNG, JPEG, WebP, SVG or canvas. A faster, more accurate html2canvas alternative with a compatible API. Zero dependencies.

    TypeScript 1 1

  2. .github .github Public

Repositories

Showing 2 of 2 repositories

People

This organization has no public members. You must be a member to see who’s a part of this organization.

Top languages

Loading…

Most used topics

Loading…