← Back to Skills Marketplace
327
Downloads
0
Stars
1
Active Installs
1
Versions
Install in OpenClaw
/install html-pages-to-images
Description
Convert multiple HTML page elements into separate high-resolution images with customizable settings and automatic file naming.
README (SKILL.md)
HTML 页面转图片 Agent Skill\r
\r 一个 Agent Skill,用于将 HTML 文件中的多个页面元素转换为独立的图片文件。\r \r
📋 功能\r
\r
- ✅ 自动识别 HTML 中的页面元素(默认
.page选择器)\r - ✅ 为每个页面生成高清截图(2x 分辨率)\r
- ✅ 根据页面编号自动命名输出文件\r
- ✅ 支持自定义参数配置\r
- ✅ 可作为 Agent Skill 被调用\r \r
📦 安装\r
\r
npm install\r
```\r
\r
## 🚀 使用方法\r
\r
### 作为 Agent Skill 使用\r
\r
```javascript\r
import { execute } from './index.js';\r
\r
const result = await execute({\r
htmlFile: 'xiaohongshu-articles.html',\r
outputDir: 'output',\r
pageWidth: 375,\r
pageHeight: 667,\r
selector: '.page'\r
});\r
\r
console.log(result);\r
```\r
\r
### 直接运行\r
\r
```bash\r
npm run convert\r
```\r
\r
或者:\r
\r
```bash\r
node index.js\r
```\r
\r
## 📁 项目结构\r
\r
```\r
.\r
├── index.js # Skill 主入口文件\r
├── skill.json # Skill 配置文件\r
├── lib/\r
│ └── convert-pages.js # 核心转换逻辑\r
├── convert-pages.js # 旧版脚本(保留兼容)\r
├── package.json\r
└── README.md\r
```\r
\r
## ⚙️ 参数配置\r
\r
| 参数 | 类型 | 默认值 | 说明 |\r
|------|------|--------|------|\r
| `htmlFile` | string | `xiaohongshu-articles.html` | HTML 文件路径(相对或绝对) |\r
| `outputDir` | string | `output` | 输出图片的目录 |\r
| `pageWidth` | number | `375` | 页面宽度(像素) |\r
| `pageHeight` | number | `667` | 页面高度(像素) |\r
| `selector` | string | `.page` | 要截图的页面元素选择器 |\r
\r
## 📤 输出\r
\r
所有图片将保存在 `output` 目录下,文件命名格式为:\r
- `page-01.png` (封面页)\r
- `page-02.png` (第一个内页)\r
- `page-03.png` (第二个内页)\r
- ...\r
\r
## 📊 返回值\r
\r
```javascript\r
{\r
success: true,\r
message: "成功转换 7 个页面为图片",\r
data: {\r
images: ["output/page-01.png", "output/page-02.png", ...],\r
count: 7,\r
outputDir: "/path/to/output"\r
}\r
}\r
```\r
\r
## 🔧 作为 Agent Skill 集成\r
\r
1. 将整个目录复制到 Agent 的 skills 目录\r
2. 在 Agent 配置中引用此 skill\r
3. 通过 `execute()` 函数调用,传入所需参数\r
\r
## 📝 示例\r
\r
```javascript\r
// 使用默认配置\r
const result1 = await execute();\r
\r
// 自定义 HTML 文件\r
const result2 = await execute({\r
htmlFile: './my-article.html'\r
});\r
\r
// 完全自定义\r
const result3 = await execute({\r
htmlFile: '/absolute/path/to/article.html',\r
outputDir: './screenshots',\r
pageWidth: 800,\r
pageHeight: 1200,\r
selector: '.article-page'\r
});\r
```\r
Usage Guidance
This package implements the claimed Puppeteer-based HTML→image conversion, but inspect and remediate the stray top-level convert-pages.js before installing or running it inside an agent. That file: (1) uses a hardcoded path into '../../workspace/.../OpenClaw 爆火.html', (2) force-deletes an OUTPUT_DIR with rmSync({ recursive: true }), and (3) immediately executes conversion without taking parameters. If you intend to use the skill, either remove/rename that stray script or verify its paths are safe and parameterized. Also run npm install in a sandbox (Puppeteer downloads browser binaries) and review package-lock if you need to audit dependencies. If you want, I can suggest a safe diff to remove or isolate the hardcoded script.
Capability Analysis
Type: OpenClaw Skill
Name: html-pages-to-images
Version: 1.0.0
The skill provides HTML-to-image conversion using Puppeteer but contains high-risk behaviors and vulnerabilities. Specifically, 'index.js' and 'lib/convert-pages.js' allow the use of absolute paths for the 'htmlFile' and 'outputDir' parameters without sanitization, enabling arbitrary file read and write access. Furthermore, a legacy script 'convert-pages.js' in the root directory includes hardcoded paths and performs recursive directory deletion ('rmSync') on those paths. While these capabilities are plausibly related to the stated purpose of processing workspace files, the lack of path validation and the use of Puppeteer with the '--no-sandbox' flag pose significant security risks.
Capability Assessment
Purpose & Capability
Most files (skill.json, index.js, lib/convert-pages.js, SKILL.md) coherently implement an HTML→image conversion skill using Puppeteer. However there is an additional top-level convert-pages.js that does not follow the skill inputs: it uses hardcoded paths under '../../workspace/xiaohongshu-output/.../OpenClaw 爆火.html' and writes/clears a sibling images directory. That hardcoded, non-parameterized behavior is not justified by the skill description and suggests leftover or targeted code.
Instruction Scope
SKILL.md describes copying the directory and calling execute() with parameters (no surprises). The library convert-pages.js matches that scope. But the standalone convert-pages.js at project root performs filesystem operations (rmSync to clear an OUTPUT_DIR, readFileSync on a hardcoded HTML file) and then immediately runs conversion; these actions are outside the documented inputs/parameters and could delete files in a workspace if executed.
Install Mechanism
No custom install script or remote archive downloads are present; installation is via npm and the package.json depends on puppeteer (registry npm). Puppeteer will download browser binaries during install/runtime, which is expected for this functionality.
Credentials
The skill declares no required environment variables or credentials, and the code does not read secrets or env vars. The remaining concern is filesystem access: the stray script accesses a specific workspace path outside the skill's declared input surface, which is a file-access mismatch but not credential exfiltration.
Persistence & Privilege
The skill does not request persistent/always-on privileges, does not modify other skills, and has normal agent-invocable settings. There is no evidence it writes agent config or requests permanent presence.
How to Use
- Make sure OpenClaw is installed (local or Docker)
- Run the install command in chat:
/install html-pages-to-images - After installation, invoke the skill by name or use
/html-pages-to-images - Provide required inputs per the skill's parameter spec and get structured output
Version History
v1.0.0
Initial release of html-pages-to-images Agent Skill.
- Converts multiple HTML page elements to individual high-resolution images.
- Automatically detects elements using the `.page` selector (customizable).
- Generates images with automatic sequential filenames (e.g., page-01.png).
- Supports custom configuration: HTML file, output directory, page dimensions, and selector.
- Can be used as an Agent Skill with a simple JavaScript API.
- Includes command-line and script usage options.
Metadata
Frequently Asked Questions
What is HTML 页面转图片?
Convert multiple HTML page elements into separate high-resolution images with customizable settings and automatic file naming. It is an AI Agent Skill for Claude Code / OpenClaw, with 327 downloads so far.
How do I install HTML 页面转图片?
Run "/install html-pages-to-images" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.
Is HTML 页面转图片 free?
Yes, HTML 页面转图片 is completely free, licensed under MIT-0. You can download, install and use it at no cost.
Which platforms does HTML 页面转图片 support?
HTML 页面转图片 is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).
Who created HTML 页面转图片?
It is built and maintained by shiker (@shiker1996); the current version is v1.0.0.
More Skills