etsy-listing-generator
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseEtsy Listing Image Generator
Etsy商品列表图片生成器
Generate professional Etsy listing images from HTML templates via Playwright screenshot rendering.
通过Playwright截图渲染功能,从HTML模板生成专业的Etsy商品列表图片。
Quick Start — Single Image
快速开始——单张图片生成
bash
node scripts/render.mjs <template> <image-url> <title> <subtitle> <badge> <output>Example:
bash
node scripts/render.mjs \
assets/puppet-listing.html \
"http://localhost:3021/api/output/moses-characters.png" \
"Bible Story Puppet Printables" \
"Moses & The Exodus" \
"12 ELEMENTS + 4 BACKGROUNDS" \
output/moses-listing.pngbash
node scripts/render.mjs <template> <image-url> <title> <subtitle> <badge> <output>示例:
bash
node scripts/render.mjs \
assets/puppet-listing.html \
"http://localhost:3021/api/output/moses-characters.png" \
"Bible Story Puppet Printables" \
"Moses & The Exodus" \
"12 ELEMENTS + 4 BACKGROUNDS" \
output/moses-listing.pngQuick Start — Batch
快速开始——批量生成
Create a JSON file with an array of objects:
json
[
{ "file": "http://localhost:3021/api/output/moses-characters.png", "subtitle": "Moses & The Exodus" },
{ "file": "http://localhost:3021/api/output/david-characters.png", "subtitle": "David & Goliath" }
]Run:
bash
node scripts/render.mjs --batch assets/puppet-listing.html stories.json output/listings/创建一个包含对象数组的JSON文件:
json
[
{ "file": "http://localhost:3021/api/output/moses-characters.png", "subtitle": "Moses & The Exodus" },
{ "file": "http://localhost:3021/api/output/david-characters.png", "subtitle": "David & Goliath" }
]运行命令:
bash
node scripts/render.mjs --batch assets/puppet-listing.html stories.json output/listings/Batch JSON Fields
批量JSON字段
| Field | Required | Default | Description |
|---|---|---|---|
| Yes | — | Product image URL (HTTP or file://) |
| No | "Bible Story Puppet Printables" | Large top text on banner |
| No | — | Smaller bottom text on banner |
| No | "12 ELEMENTS + 4 BACKGROUNDS" | Left badge text |
| No | Auto from subtitle | Output filename |
| 字段 | 必填 | 默认值 | 描述 |
|---|---|---|---|
| 是 | — | 产品图片URL(HTTP或file://格式) |
| 否 | "Bible Story Puppet Printables" | 横幅顶部大文本 |
| 否 | — | 横幅底部小文本 |
| 否 | "12 ELEMENTS + 4 BACKGROUNDS" | 左侧徽章文本 |
| 否 | 自动从副标题生成 | 输出文件名 |
Template Placeholders
模板占位符
Templates are plain HTML files. The renderer replaces these strings:
- → product/character image
PRODUCT_IMAGE_URL - → large banner text
TITLE_TEXT - → smaller banner text
SUBTITLE_TEXT - → left pill badge
BADGE_LEFT_TEXT - → right badge (hardcoded, edit HTML to change)
INSTANT DOWNLOAD
模板为纯HTML文件,渲染器会替换以下字符串:
- → 产品/角色图片
PRODUCT_IMAGE_URL - → 横幅大文本
TITLE_TEXT - → 横幅小文本
SUBTITLE_TEXT - → 左侧胶囊徽章
BADGE_LEFT_TEXT - → 右侧徽章(硬编码,需编辑HTML修改)
INSTANT DOWNLOAD
Template Design — Current Base (puppet-listing.html)
模板设计——当前基础模板(puppet-listing.html)
- 1400×2000px portrait format
- White background, sage green (#4D6840) bottom banner
- Gold pill badges (top-left: custom, top-right: INSTANT DOWNLOAD)
- Poppins font throughout
- Product image uses
object-fit: cover; object-position: center center - Subtle TheSunDaisy watermark
- 1400×2000px 竖版格式
- 白色背景,鼠尾草绿(#4D6840)底部横幅
- 金色胶囊徽章(左上角:自定义,右上角:INSTANT DOWNLOAD)
- 全程使用Poppins字体
- 产品图片使用样式
object-fit: cover; object-position: center center - 淡色TheSunDaisy水印
Creating New Templates
创建新模板
Copy and modify. Key CSS to adjust:
assets/puppet-listing.html- width/height — canvas dimensions
.canvas - height — green section size
.banner - top/bottom — image boundaries
.product-area - styling — pill badge appearance
.badge - /
.title— typography.subtitle
Keep the placeholder strings (, etc.) for the renderer to replace.
PRODUCT_IMAGE_URL复制并修改。需调整的关键CSS:
assets/puppet-listing.html- width/height — 画布尺寸
.canvas - height — 绿色区域大小
.banner - top/bottom — 图片边界
.product-area - styling — 胶囊徽章样式
.badge - /
.title— 排版.subtitle
保留占位符字符串(等)以便渲染器替换。
PRODUCT_IMAGE_URLServing Local Images
本地图片服务
If product images are local files, either:
- Serve via Image Forge backend: copy to → accessible at
/projects/image-forge/output/http://localhost:3021/api/output/filename.png - Use URLs (must be absolute paths)
file:// - Start any local HTTP server in the image directory
如果产品图片是本地文件,可选择以下方式:
- 通过Image Forge后端服务:复制到→ 可通过
/projects/image-forge/output/访问http://localhost:3021/api/output/filename.png - 使用格式URL(必须为绝对路径)
file:// - 在图片目录启动任意本地HTTP服务器
Dependencies
依赖项
- Node.js
- Playwright (if not installed)
npx playwright install chromium
- Node.js
- Playwright(若未安装,执行)
npx playwright install chromium