SkillsGrove
SkillsGrove/디자인 및 이미지/inclusionAI/AWorld/html-to-image

html-to-image

설치

$npx skills add https://github.com/inclusionAI/AWorld --skill html-to-image
$git clone --depth 1 https://github.com/inclusionAI/AWorld.git /tmp/AWorld && mkdir -p ~/.claude/skills && cp -r /tmp/AWorld/examples/skill_agent/skills/html-to-image ~/.claude/skills/html-to-image
이 Agent Skill을 설치해 주세요: https://github.com/inclusionAI/AWorld/tree/bef598fcfb60da988c2660cafcf0d45f0128e8bf/examples/skill_agent/skills/html-to-image — 먼저 SKILL.md와 스크립트를 읽고, 안전하다고 확인한 뒤에만 제 skills 폴더에 설치해 주세요.

요약

원문 설명 · MITHTML 转图片 skill - 将 HTML 文件或内容通过 agent-browser 渲染并截图为图片。适用于生成信息图、社交媒体配图、数据可视化截图等场景。
아래 SKILL.md는 inclusionAI/AWorld(커밋 bef598f)에서 MIT 라이선스에 따라 게시한 것입니다. 본문은 변경하지 않았으며, 파일 상단의 메타데이터만 생략하고 이미지는 링크로 표시하며 매우 긴 파일은 일부만 표시합니다. Copyright 2025 [Inclusion AI]. 라이선스: LICENSE. 지침 파일만 표시되며 스크립트 등은 원본 저장소를 참고하세요.

HTML 转图片 (html-to-image)

概述

将 HTML 文件或内容通过 agent-browser 渲染为图片。典型用法:Claude 生成精美 HTML → 本 skill 截图 → 得到可直接发布的图片。

工具路径

  • 脚本:.claude/skills/html-to-image/html_to_image.sh
  • 依赖:agent-browser(CDP 已连接)、python3

用法

./html_to_image.sh -o <output> [-f <html_file> | -c <html_content>] [-w <width>] [-p <cdp_port>] [--full]

参数

参数 说明 必填 默认
-o 输出图片路径(.png) 是 -
-f HTML 文件路径(与 -c 二选一) 二选一 -
-c HTML 内容字符串(与 -f 二选一) 二选一 -
-w 视口宽度 否 1080
-e 视口高度(不指定则全页截图) 否 -
-p CDP 端口 否 9222
--full 全页截图(忽略视口高度限制) 否 默认开启

示例

# 从 HTML 文件截图
./html_to_image.sh \
  -f card.html -o card.png

# 直接传入 HTML 内容
./html_to_image.sh \
  -c '<html><body><h1>Hello</h1></body></html>' \
  -o hello.png

# 指定宽度(适配手机尺寸)
./html_to_image.sh \
  -f infographic.html -o output.png -w 750

# 固定视口截图(非全页)
./html_to_image.sh \
  -f page.html -o output.png -w 1080 -e 1920 --no-full

典型工作流

  1. Claude 根据内容生成精美 HTML(信息图、卡片等)
  2. 使用本 skill 截图为 PNG
  3. 将截图传给 xhs-publisher 发布到小红书
# 生成图片
./html_to_image.sh -f card.html -o card.png

# 发布到小红书
./.claude/skills/xhs-publisher/publish_xhs.sh -t "标题" -c "正文" -i card.png
라이선스 전문 보기(MIT)
MIT License

Copyright (c) 2025 [Inclusion AI]

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.