Some links on this page are affiliate links: if you buy through them we may earn a commission, at no extra cost to you.
The GitHub project bubkoo/html-to-image is a JavaScript library for rendering a DOM node as an image-related output in the browser. Its README documents promise-based functions for PNG, SVG, JPEG, Blob, Canvas, and pixel data. It is not a hosted service that accepts a URL and renders it remotely: your code supplies a DOM node. If you need a screenshot of a public website rather than an element in your own page, that is a different job.
What is the html-to-image GitHub project?
bubkoo/html-to-image is an open-source JavaScript project described by its maintainers as generating an image from a DOM node using HTML5 canvas and SVG. The repository calls it a fork of dom-to-image, with more maintainable code and additional features. Its intended input is a node already present in a web page, such as a chart, card, or report container.
The repository documents these output functions: toPng, toSvg, toJpeg, toBlob, toCanvas, and toPixelData. They accept a DOM node and rendering options and return promises. This is library documentation, not a guarantee of identical results in every browser or for every kind of page content.
Recommended Free Tools
What it is not
It does not, by itself, provide a remote browser, accept a URL for server-side rendering, or operate as a screenshot API. You must run it in an environment with the relevant DOM node. For an image of a page your own application renders, that can be a direct fit; for a page on another site, you need a different capture approach.
#1 Best Overall
Install the package and prepare a DOM node
The repository README documents installation through npm:
npm install --save html-to-image
Call the library after the target element exists in the document. For example, in a browser module with an element whose ID is report:
import * as htmlToImage from 'html-to-image';
const node = document.getElementById('report');
if (!node) {
throw new Error('Could not find #report');
}
htmlToImage.toPng(node)
.then((dataUrl) => {
const image = new Image();
image.src = dataUrl;
document.body.appendChild(image);
})
.catch((error) => {
console.error('Could not render the node:', error);
});
This illustrates the README’s promise-based pattern. The target must be a DOM element, not a URL string. Add your own application-specific handling for loading state, user interaction, and errors.
Crashes, No Sound, or Screen Glitches?
Random freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.Free scan · under a minutePC Slower Than It Used to Be?
A free scan shows the junk files, broken settings and background clutter dragging Windows down - then fixes them in one click.Free scan · Windows 10 & 11Choose the output you need
Use the function that matches what your application will do with the result. The repository documents the following output types:
| Function | Result | Typical use |
|---|---|---|
toPng |
PNG data URL | Display or download a raster image. |
toJpeg |
JPEG data URL | Produce a JPEG image. |
toSvg |
SVG data URL | Keep the generated output in SVG form. |
toBlob |
Blob | Use an image blob in browser APIs or create a download URL. |
toCanvas |
Canvas | Continue working with the rendered canvas. |
toPixelData |
Pixel data | Consume pixel values in code that needs them. |
The README documents function names and examples; it does not establish a universal quality or performance ranking among formats. Select based on downstream needs. For example, a browser download can be built from a data URL:
Rank #2
htmlToImage.toPng(node)
.then((dataUrl) => {
const link = document.createElement('a');
link.download = 'report.png';
link.href = dataUrl;
link.click();
});
The README also shows JPEG download and PNG display patterns. A PNG is suitable when your workflow expects that format; if you need a PDF, the library’s documented output list is not a PDF export interface.
Set dimensions, background, styles, and filtering
The README lists options for filtering nodes, choosing a background color, setting width and height, setting canvas width and height, and overriding styles. Pass an options object as the second argument to a rendering function. For example, to request explicit dimensions and a white background:
Do these 3 things before closing this tab:
1Clear out junk files and repair common Windows errors2Scan for outdated or missing drivers - takes under a minute3Repair Windows errors before they cause bigger problemshtmlToImage.toPng(node, {
backgroundColor: '#ffffff',
width: 1200,
height: 800,
canvasWidth: 1200,
canvasHeight: 800
});
The project documents these option categories, but exact outcomes depend on the target content and how the rendered node is styled. Check the repository README for the current API details and examples before relying on a specific option behavior.
Exclude elements with a filter
A filter function can omit a node and its descendants from the rendered result. The README notes that the filter is not called on the root node. That distinction matters: a filter intended to remove a child control should be written to match that child, rather than expecting it to reject the entire root container.
htmlToImage.toPng(node, {
filter: (element) => !element.classList?.contains('no-export')
});
Use this for interface elements that should remain visible in the live application but not in the export, such as action buttons. Test the output with the actual DOM structure: excluding a parent also excludes its descendants.
When a browser library is the right fit
The key decision is where the content lives and where rendering should happen:
- Use html-to-image when the element is already rendered in a browser page you control and you want client-side code to convert that element.
- Choose another rendering method when you need to submit arbitrary HTML or a public URL to a remote service, run captures independently of a visitor’s browser, or produce an output format outside the package’s documented functions.
The repository is distributed under the MIT License, according to its README. Its documentation is not an independent compatibility matrix, benchmark, or promise of support for every browser, resource, or page configuration. The available evidence does not establish current browser coverage or comparative performance, so validate the precise content and deployment environment your application uses.
Distinguish the library from hosted rendering services
html-to-image and a hosted rendering API solve related but different problems. The library takes a DOM node in your page; a hosted service can accept remote inputs according to that service’s API and terms. A hosted option may be more suitable when your application has no suitable browser DOM at capture time or when you need a central service for URL rendering.
One separate service surfaced in this context is html2img.com. Its official getting-started documentation describes rendering raw HTML/CSS, public URLs, and named templates, with API keys and SDKs or integrations; it says HTML and screenshot endpoints can return PDF as well as PNG. Its GitHub organization page advertises 25 free monthly renders, a vendor statement that may change. These are claims about that hosted service, not features of the html-to-image package.
Or skip the browser setup
If the task is capturing a website URL rather than exporting a DOM node already in your own page, ScreenshotNeo is a screenshot API and MCP server for developers. One GET request can return PNG, JPEG, WebP, or PDF. Before capture, it accepts cookie or consent banners like a visitor and removes more than 60 known consent platforms, newsletter popups, and chat widgets; each of those steps can be turned off. Bot checks, blank pages, timeouts, failed loads, and cache hits are not billed, and the response identifies the page verdict and billing status in X-Page-Verdict and X-Billed headers.
Free tools Windows power users keep installed
One-click scans. No signup required.
Install nothing in the page being captured: send a request to the API with your key and target URL. This cURL example saves a WebP file:
Rank #4
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
See the ScreenshotNeo documentation for the API’s options and request details. The same request in Python is:
import requests
r = requests.get(
"https://api.screenshotneo.com/v1/shot",
params={"access_key": "YOUR_API_KEY", "url": "https://stripe.com"},
timeout=90,
)
r.raise_for_status()
open("shot.webp", "wb").write(r.content)
And in Node.js:
const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://stripe.com' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);
if (!res.ok) throw new Error(`Screenshot request failed: ${res.status}`);
await import('node:fs/promises').then(({ writeFile }) => writeFile('shot.webp', Buffer.from(await res.arrayBuffer())));
Beyond a basic capture, its options include full-page capture with lazy images loaded, CSS-selector element capture, dark mode, 12 device presets or a custom viewport, retina scale, PDF settings, custom CSS and JavaScript, clicking or hiding elements, waits, request blocking, headers, cookies, user agent, authorization, timezone, geolocation, transparent backgrounds, resizing, caching, signed image links, asynchronous jobs with signed webhooks, bulk capture up to 100 URLs per call, usage API, and OpenAPI specification. It also accepts parameter names used by other screenshot APIs to ease migration. An MCP server exposes take_screenshot, get_page_info, and capture_pdf to Claude, Cursor, and other MCP clients.
Plans are Free with 1,000 shots per month and no card; Starter $5 for 3,000; Growth $15 for 15,000; Pro $39 for 60,000; Scale $99 for 250,000; and Business $249 for 1,000,000. Yearly billing gives two months free, and every feature is available on every plan. For public-page captures, the free plan includes 1,000 screenshots a month with no card, and paid plans start at $5 for 3,000. Sign up free for ScreenshotNeo.
Quick wins for a faster PC:
Clear out junk files and repair common Windows errorsFree Scan →Scan for outdated or missing drivers - takes under a minuteDriver Scan →Repair Windows errors before they cause bigger problemsFix Now →Troubleshooting and operational checks
The target element is missing
If your lookup returns null, the selector did not find a node. Check the element ID or selector and call the conversion only after the application has rendered the target. In a framework, ensure the capture runs after the relevant component is mounted.
The output omits content
Check whether the missing content is a descendant excluded by your filter, and confirm that the target node is the container you intended. The README explains filtering behavior, including that rejecting a parent omits its descendants and that the root itself is not passed to the filter.
Best Value
The render fails or differs from expectation
Handle promise rejection and inspect the actual error rather than assuming the output was created. The README documents the API but does not establish universal compatibility for all browser content. Reproduce the issue with the smallest target node and consult the project’s current documentation for constraints relevant to that content.
Deciding between in-page and remote capture
If your code has a live DOM node, the library’s input model is direct. If you only have a URL or need remote processing, use a service whose documentation explicitly supports URL capture, and account for its API key, service terms, and output options. Do not attribute a hosted service’s URL, template, or PDF capabilities to the npm package.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Project status and licensing details
The repository’s README states that its scripts and documentation are released under the MIT License. An npm listing crawled in 2026 displayed version 1.11.13 and described its last publish as two years earlier; those are crawl-time listing details, not a verified statement of release status today. The same crawl displayed 4,231,419 weekly downloads, a volatile npm figure rather than a stable measure of current adoption. Check the repository and registry directly for current version and maintenance information before choosing a dependency for a new project.
Frequently Asked Questions
Is html-to-image the same as html2img.com?
No. html-to-image is a JavaScript package that converts a DOM node in a page; html2img.com is a separate hosted rendering service.
Can the html-to-image package capture any public website from its URL?
Its documented input is a DOM node, not a URL. A URL-based capture requires a separate service or an application that first loads the page into a DOM you control.
Does the package directly export PDF?
The documented functions return PNG, SVG, JPEG, Blob, Canvas, or pixel data. The README does not list a PDF export function.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

