tsayen

dom-to-image: Turn DOM Elements into Images

A JavaScript library that converts DOM nodes into SVG, PNG, JPEG, or pixel data. It can help browser-based tools export styled interface elements, but its inactive maintenance and browser limitations matter for adoption.

InactiveJavaScriptLibraryHTMLImage Processing
View on GitHub Compare
Stars
10.8k
Forks
1.7k
Stars, last 30 days
-6
Last commit
2.5 years ago
Contributors
10

Our take

Inactiveno commits in over a year

Health score

22/100

How it is scored
Activity
19
Community
27
Issues
21
Pull requests
20

-6 stars in the last 30 days

This is a focused browser-side export library, but its inactive status and highly concentrated contributions make it a higher-maintenance-risk choice for new dependencies.

Good fit if

  • You need to export existing DOM content as SVG, PNG, JPEG, or pixels rather than recreate it separately.
  • Your target browser supports SVG <foreignObject>, and the relevant fonts and images can be accessed.
  • You can assess the maintenance risk and verify the library against your own rendered content.

Look elsewhere if

  • You require supported Internet Explorer or Safari rendering, which the project explicitly excludes.
  • Your project needs a dependency with recent commits, releases, or demonstrated recent issue handling.
  • You need a clearly verified license record before adoption, since repository metadata reports no asserted license even though the README says MIT.
All health signals
Last commit2024-04-08 (2.5 years ago)
Commits, last 90 days0
Releases, last 12 months0
Contributors10 (top contributor: 94% of commits)
Issues closed, last 90 days0
Project age11 years

Checked on 2026-10-07 with the GitHub API.

Project history

Daily GitHub snapshots since Oct 7, 2026. History covers stars and forks; health signals are not tracked historically.

Selected snapshot

Stars

10,767

Forks

1,670

Change since Nov 17, 2026: 0 stars·0 forks

Overview

dom-to-image converts a DOM node into an SVG or raster image. It addresses the need to export part of a rendered web page without rebuilding that content separately in an image-generation pipeline.

The library clones the node, copies computed styles, embeds fonts and images, and renders through SVG <foreignObject>. Use it in browser code where that rendering path is supported and the source content can be accessed safely.

Key Features

  • Export nodes as SVG, PNG, or JPEG data URLs.
  • Return a PNG Blob for downloading or other browser workflows.
  • Read rendered output as raw RGBA pixel data.
  • Filter nodes from an export and override dimensions, styles, or background color.
  • Inline web fonts and images as part of rendering.
  • Configure JPEG quality, cache busting, and a placeholder for failed image fetches.

Use Cases

  • A frontend developer can add export buttons for charts, cards, or other DOM-based components.
  • A product team can let users save a styled preview or composed interface element as an image.
  • A developer building visual tests can retrieve pixel data or compare rendered output.
  • A reporting tool can export a DOM-based summary when its content and assets are available to the browser.

What you need

Detected in the repository

  • Node.js (from package.json)
  • A test suite

Getting Started

Install from npm:

npm install dom-to-image

See the README for imports, rendering options, and examples.

License in Plain Words

No standard license was detected. Without a license, the default copyright rules apply: you may read the code, but not reuse it. Check the repository or ask the authors.

Considerations

The project is marked inactive: it has had no commits or releases in over a year, and the measured data shows no issues closed recently. Most of the code comes from one person, despite contributions from other contributors, so ongoing maintenance may depend heavily on that individual.

Rendering depends on browser support for SVG <foreignObject> and promises. The README says Internet Explorer and Safari are unsupported, and notes a Firefox issue involving some external stylesheets. Canvas content can also fail if it is tainted by cross-origin resources. The README states an MIT license, but repository metadata does not assert a license, so verify the applicable license before relying on it.

Found this useful?

Share it with someone who would like dom-to-image.