← 返回 Skills 市场
shiker1996

HTML 页面转图片

作者 shiker · GitHub ↗ · v1.0.0 · MIT-0
cross-platform ⚠ suspicious
327
总下载
0
收藏
1
当前安装
1
版本数
在 OpenClaw 中安装
/install html-pages-to-images
功能描述
Convert multiple HTML page elements into separate high-resolution images with customizable settings and automatic file naming.
使用说明 (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
安全使用建议
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.
功能分析
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.
能力评估
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.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install html-pages-to-images
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /html-pages-to-images 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
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.
元数据
Slug html-pages-to-images
版本 1.0.0
许可证 MIT-0
累计安装 1
当前安装数 1
历史版本数 1
常见问题

HTML 页面转图片 是什么?

Convert multiple HTML page elements into separate high-resolution images with customizable settings and automatic file naming. 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 327 次。

如何安装 HTML 页面转图片?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install html-pages-to-images」即可一键安装,无需额外配置。

HTML 页面转图片 是免费的吗?

是的,HTML 页面转图片 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。

HTML 页面转图片 支持哪些平台?

HTML 页面转图片 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 HTML 页面转图片?

由 shiker(@shiker1996)开发并维护,当前版本 v1.0.0。

💬 留言讨论