重要前提
安装AI Skills的关键前提是:必须科学上网,且开启TUN模式,这一点至关重要,直接决定安装能否顺利完成,在此郑重提醒三遍:科学上网,科学上网,科学上网。查看完整安装教程 →
html-to-image by html2png/skills
npx skills add https://github.com/html2png/skills --skill html-to-image通过 html2png.dev 将 HTML/CSS 转换为 PNG、WebP 或 PDF。
POST https://html2png.dev/api/convert
以原始正文或 JSON 格式发送 HTML:
curl -X POST "https://html2png.dev/api/convert?width=1200&height=630" \
-H "Content-Type: text/html" \
-d '<div style="padding: 40px;">Content</div>'
curl -X POST "https://html2png.dev/api/convert" \
-H "Content-Type: application/json" \
-d '{"html": "<div>...</div>", "width": 1200}'
| 参数 | 类型 | 默认值 | 描述 |
|---|---|---|---|
html | string |
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
| 必需 |
| HTML 内容 |
width | int | 1200 | 宽度(像素) |
height | int | 630 | 高度(像素) |
format | string | png | png, webp, pdf |
deviceScaleFactor | float | 2 | 视网膜缩放比例 (1-4) |
delay | int | 0 | 捕获前等待毫秒数 |
selector | string | body | 要捕获的 CSS 选择器 |
omitBackground | bool | false | 透明背景 |
colorScheme | string | - | light 或 dark |
zoom | float | 1 | 视口缩放比例 |
{
"success": true,
"url": "https://html2png.dev/api/blob/abc.png",
"format": "png",
"cached": false
}
使用以下 CDN 获取高质量设计:
Tailwind CSS (推荐):
<script src="https://cdn.tailwindcss.com"></script>
Google Fonts:
<link
href="https://fonts.googleapis.com/css2?family=Inter:wght@400;600;800&display=swap"
rel="stylesheet"
/>
图标 (代替内联 SVG):
https://unpkg.com/lucide@latesthttps://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css图片:
https://images.unsplash.com/photo-xxx<!DOCTYPE html>
<html>
<head>
<script src="https://cdn.tailwindcss.com"></script>
<link
href="https://fonts.googleapis.com/css2?family=Inter:wght@400;600;800&display=swap"
rel="stylesheet"
/>
<script src="https://unpkg.com/lucide@latest"></script>
</head>
<body
class="bg-gradient-to-br from-purple-600 to-blue-600 flex items-center justify-center"
style="width: 1200px; height: 630px; font-family: 'Inter', sans-serif;"
>
<div
class="bg-white/10 backdrop-blur-lg rounded-2xl p-12 text-white text-center"
>
<i data-lucide="sparkles" class="w-16 h-16 mx-auto mb-4"></i>
<h1 class="text-6xl font-extrabold mb-4">Hello World</h1>
<p class="text-2xl opacity-90">Beautiful generated image</p>
</div>
<script>
lucide.createIcons();
</script>
</body>
</html>
为等待资源加载而设置延迟的请求:
curl -X POST "https://html2png.dev/api/convert?width=1200&height=630&delay=1000&deviceScaleFactor=2" \
-H "Content-Type: text/html" \
-d '<!DOCTYPE html>...</html>'
deviceScaleFactor=2 或更高值delay=1000-2000POST https://html2png.dev/api/screenshot
curl -X POST "https://html2png.dev/api/screenshot" \
-H "Content-Type: application/json" \
-d '{"url": "https://example.com", "width": 1280, "fullPage": true}'
额外参数:fullPage (bool), userAgent (string)
每个 IP 地址每小时 50 次请求。缓存结果免费。
每周安装数
48
代码仓库
GitHub 星标数
6
首次出现
2026年1月27日
安全审计
安装于
opencode47
amp46
gemini-cli46
codex46
github-copilot46
kimi-cli45
Convert HTML/CSS to PNG, WebP, or PDF via html2png.dev.
POST https://html2png.dev/api/convert
Send HTML as raw body or JSON:
curl -X POST "https://html2png.dev/api/convert?width=1200&height=630" \
-H "Content-Type: text/html" \
-d '<div style="padding: 40px;">Content</div>'
curl -X POST "https://html2png.dev/api/convert" \
-H "Content-Type: application/json" \
-d '{"html": "<div>...</div>", "width": 1200}'
| Parameter | Type | Default | Description |
|---|---|---|---|
html | string | required | HTML content |
width | int | 1200 | Width in px |
height | int | 630 | Height in px |
format | string | png | png, webp, pdf |
deviceScaleFactor | float | 2 | Retina scale (1-4) |
delay | int | 0 | Wait ms before capture |
selector | string | body | CSS selector to capture |
omitBackground | bool | false | Transparent bg |
colorScheme | string | - | light or dark |
zoom | float | 1 | Viewport zoom |
{
"success": true,
"url": "https://html2png.dev/api/blob/abc.png",
"format": "png",
"cached": false
}
Use these CDNs for high-quality designs:
Tailwind CSS (preferred):
<script src="https://cdn.tailwindcss.com"></script>
Google Fonts:
<link
href="https://fonts.googleapis.com/css2?family=Inter:wght@400;600;800&display=swap"
rel="stylesheet"
/>
Icons (use instead of inline SVGs):
https://unpkg.com/lucide@latesthttps://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.cssImages:
https://images.unsplash.com/photo-xxx<!DOCTYPE html>
<html>
<head>
<script src="https://cdn.tailwindcss.com"></script>
<link
href="https://fonts.googleapis.com/css2?family=Inter:wght@400;600;800&display=swap"
rel="stylesheet"
/>
<script src="https://unpkg.com/lucide@latest"></script>
</head>
<body
class="bg-gradient-to-br from-purple-600 to-blue-600 flex items-center justify-center"
style="width: 1200px; height: 630px; font-family: 'Inter', sans-serif;"
>
<div
class="bg-white/10 backdrop-blur-lg rounded-2xl p-12 text-white text-center"
>
<i data-lucide="sparkles" class="w-16 h-16 mx-auto mb-4"></i>
<h1 class="text-6xl font-extrabold mb-4">Hello World</h1>
<p class="text-2xl opacity-90">Beautiful generated image</p>
</div>
<script>
lucide.createIcons();
</script>
</body>
</html>
Request with delay for resources to load:
curl -X POST "https://html2png.dev/api/convert?width=1200&height=630&delay=1000&deviceScaleFactor=2" \
-H "Content-Type: text/html" \
-d '<!DOCTYPE html>...</html>'
deviceScaleFactor=2 or higher for qualitydelay=1000-2000 when loading fonts/icons/imagesPOST https://html2png.dev/api/screenshot
curl -X POST "https://html2png.dev/api/screenshot" \
-H "Content-Type: application/json" \
-d '{"url": "https://example.com", "width": 1280, "fullPage": true}'
Extra params: fullPage (bool), userAgent (string)
50 requests/hour per IP. Cached results are free.
Weekly Installs
48
Repository
GitHub Stars
6
First Seen
Jan 27, 2026
Security Audits
Gen Agent Trust HubFailSocketPassSnykWarn
Installed on
opencode47
amp46
gemini-cli46
codex46
github-copilot46
kimi-cli45
Lark CLI IM 即时消息管理工具:机器人/用户身份操作聊天、消息、文件下载
48,700 周安装
React 19专家 | 服务器组件、性能优化与生产级架构实战指南
1,500 周安装
Playwright浏览器自动化教程:Python爬虫、UI测试、数据采集与定时任务
45 周安装
微信公众号文章发布器 - 通过API将Markdown/HTML内容发布到公众号草稿箱
1,400 周安装
全栈安全开发指南 - Fullstack Guardian 安全编码与三视角设计实践
1,400 周安装
Vercel Workflow 开发指南:持久化异步函数与可缓存步骤函数
1,400 周安装
CloudBase微信小程序认证指南:无缝集成用户身份,实现自动登录与安全验证
1,400 周安装