snapdom

Converts HTML DOM elements to SVG, PNG, JPG, WebP preserving styles and embedded fonts.

Updated Feb 23, 2026
One-click install
npx skills add https://github.com/zphwd/bianchengbaodian --skill snapdom-zphwd
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: snapdom
Source: https://github.com/zphwd/bianchengbaodian/tree/main/skills/snapdom
Command: npx skills add https://github.com/zphwd/bianchengbaodian --skill snapdom-zphwd

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) and assets (resource) components.

What problem does it solve?

This Skill addresses the need to convert HTML elements into various image formats, preserving their exact styling and content, which is often difficult with standard screenshot tools.

Core Features & Use Cases

  • DOM to Image Conversion: Transforms HTML elements into SVG, PNG, JPG, WebP, or Canvas formats.
  • Style Preservation: Accurately captures embedded fonts, pseudo-elements, shadows, and transforms.
  • Use Case: You need to generate a high-quality, scalable image of a complex UI component for documentation or a marketing asset.

Quick Start

Use the snapdom skill to convert the HTML element with the ID 'my-element' into a PNG image.

Frequently Asked Questions about snapdom

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I convert an HTML DOM element to an SVG or PNG image?

To convert an HTML DOM element to an image, you capture the target node and serialize it into SVG, PNG, JPG, or WebP formats. This process accurately preserves embedded fonts, pseudo-elements, shadows, and CSS transforms during rendering.

What is the best way to capture web components without losing CSS effects?

Capturing web components while preserving CSS effects requires a DOM serialization method that clones styles directly from the rendered document. This ensures shadows, embedded fonts, and pseudo-elements maintain high fidelity in the final image output.

Does DOM to image conversion handle cross-origin resources and embedded fonts?

DOM to image conversion handles cross-origin resources using a CORS fallback mechanism. This ensures external assets and embedded fonts are correctly fetched and rendered without tainting the canvas or breaking the captured image.

Can I exclude specific elements when taking an HTML screenshot?

You can exclude specific elements during an HTML screenshot using selective element exclusion features. This allows you to omit designated DOM nodes from the final SVG or PNG output while capturing the surrounding layout.

DOM to image conversion not working, what are the limitations with CSS rendering?

DOM to image conversion limitations may arise if CSS rendering relies on unsupported external stylesheets or complex cross-origin restrictions. Utilizing the plugin system for custom transformations can help bypass specific rendering bottlenecks.

snapdom vs other DOM to image tools for performance?

Compared to other DOM to image tools, this approach offers performance advantages by directly serializing HTML elements with high fidelity. It avoids heavy canvas re-rendering, resulting in faster capture of complex UI components.