faster than full-page toCanvas on a long page
Replace html2canvas.
Use SnapDOM.
SnapDOM captures a DOM subtree once and returns a reusable result. Export it as PNG, JPG, WebP, SVG, Canvas or Blob—or add a custom format with a plugin.

Meet Mr. SnapDOM
Official mascot. Guardian of faster, sharper DOM captures.
Why replace html2canvas?
html2canvas reads the page and redraws supported CSS on a canvas. SnapDOM produces a self-contained DOM representation that can be exported more than once.
Measured on the same DOM
Chromium benchmark speedup of SnapDOM current versus each competitor. Higher is better. Results are from the project’s public Vitest benchmark suite.
Simple node
Complex node
faster than html2canvas for rasterized PNG at scale 2
faster on a background-image gallery
git clone https://github.com/zumerlab/snapdom.git
cd snapdom
npm install
npm run test:benchmarkMigrate in three minutes
Keep your UI. Upgrade the capture engine.
Install
Add the @zumer/snapdom package.
Swap the call
Pass the same target element to snapdom.toPng().
Reuse the DOM
Capture once, then export repeatedly without re-cloning.
Compare the alternatives
The libraries solve similar tasks, but they do not share the same architecture, maintenance history or extension model.
html2canvas
Canvas re-rendererPopular and familiar, but it interprets the page and redraws supported CSS onto a canvas.
html-to-image
Maintained forkA more maintainable dom-to-image fork with useful output helpers, built on the same SVG foreignObject lineage.
dom-to-image
Influential originalThe project that inspired many successors. Simple and important, but its architecture now shows its age.
dom-to-image-more
Patched successorAdds valuable fixes and iframe support while keeping the original architecture and API shape.
For new client-side DOM capture work, SnapDOM offers the broadest path beyond a fixed image-export API.
Plugins are part of the architecture
Plugins can participate in capture, transform the result and register custom export formats.
Control what enters
Filter nodes, replace content and prepare the DOM before export.
+Change the result
Compose filters, overlays and post-processing without forking the core.
+Invent a format
Go beyond images: community examples include ASCII, PDF and prompt-oriented exports.
+Build your workflow
Register plugins globally or per capture and combine them freely.
+Everyday recipes
The few patterns you’ll use in almost every product.
import { snapdom } from 'snapdom'
const card = document.querySelector('#card')
const image = await snapdom.toPng(card)
await image.download({ filename: 'card.png' })Capture the browser’s resolved DOM
At capture time, layout, fonts and styles have already been resolved. SnapDOM preserves that state in a portable representation instead of implementing a second CSS renderer.
Questions before you switch
01Is SnapDOM only a screenshot library?+
No. It is a DOM Capture Engine: snapdom() creates a reusable representation that can be transformed and exported repeatedly.
02Can I create a custom format?+
Yes. The plugin system lets you add exporters and hook into the capture pipeline.
03Can I still get a canvas?+
Yes. Use snapdom.toCanvas(element), or choose PNG, JPG, WebP, SVG and Blob.
04What about cross-origin images?+
Browser security still applies. SnapDOM supports a useProxy option for CORS-denied resources.
Migrate one capture first.
Compare the output in your supported browsers, then remove the old dependency.