
Wechat Sticker Maker
- 51 installs
- 28 repo stars
- Updated July 16, 2026
- guanyang/super-publisher
Crop a grid sticker sheet into WeChat-compliant assets (240x240 main images, 50x50 icons) with auto-generated metadata templates.
About
A Python tool that slices 6/9/12-grid images into individually numbered stickers at WeChat's required sizes and generates meta/info templates. A developer uses it to prepare a sticker pack for the WeChat sticker platform.
- Auto-crops multiple grid layouts to 240x240 main images and 50x50 chat icons
- Generates cover/icon candidates and auto-fills meaning and album-info metadata
Wechat Sticker Maker by the numbers
- 51 all-time installs (skills.sh)
- Ranked #891 of 1,335 Generative Media skills by installs in the Skillselion catalog
- Data as of Jul 24, 2026 (Skillselion catalog sync)
npx skills add https://github.com/guanyang/super-publisher --skill wechat-sticker-makerAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 51 |
|---|---|
| repo stars | ★ 28 |
| Last updated | July 16, 2026 |
| Repository | guanyang/super-publisher ↗ |
What it does
Crop a grid sticker sheet into WeChat-compliant assets (240x240 main images, 50x50 icons) with auto-generated metadata templates.
Files
微信表情包制作工具 (WeChat Sticker Maker)
本 Skill 旨在帮助用户快速将设计好的网格拼图(如六宫格、九宫格、十二宫格)自动裁剪并生成符合微信表情开放平台规范的素材。
核心功能
- 自动裁剪:支持 2x3, 3x2, 3x3, 3x4, 4x3 等多种网格布局。
- 规范转换:
- 表情主图:统一调整为 240x240 像素 (PNG)。
- 聊天页图标:统一调整为 50x50 像素 (PNG)。
- 含义词生成:自动生成
meta.txt文件,预留“含义词”填写位置,方便批量管理。 - 信息模板生成:自动生成
info.txt文件,包含【表情名称】、【表情介绍】、【一句话简介】的填写模板及字数限制提示。 - 候选素材生成:自动提取第1张表情,生成符合规范的【头像/封面图候选】(240x240) 和 【聊天页图标候选】(50x50)。
- 自动命名:按照微信规范自动编号 (01, 02, ...)。
使用指南
1. 快速开始 (Quick Start)
无需手动安装依赖,直接运行脚本即可。工具会自动创建虚拟环境 (.venv) 并安装所需依赖。
# 基本用法:自动处理并生成
./skills/wechat-sticker-maker/scripts/run.sh /path/to/your/grid_image.png
# 常用选项:
# - 指定布局 (例如 3x3)
./skills/wechat-sticker-maker/scripts/run.sh /path/to/image.png --layout 3x3
# - 指定输出目录
./skills/wechat-sticker-maker/scripts/run.sh /path/to/image.png --output ./my_stickers2. (可选) 手动安装
如果您希望手动管理环境:
python3 -m venv .venv
source .venv/bin/activate
pip install -r skills/wechat-sticker-maker/requirements.txt
python3 skills/wechat-sticker-maker/scripts/make_stickers.py ...3. 输出结果
脚本将在指定的输出目录下生成两个子文件夹和多个文件。
- 默认输出路径:如果用户未指定,默认创建并输出到
output/stickers_[theme]目录(其中[theme]根据该表情包的具体主题进行替换,如output/stickers_cat)。 - 自定义输出路径:用户也可以通过
--output指定自定义输出目录。 - 输出内容:
-
main/: 存放 表情主图 (240x240) -
icon/: 存放 表情缩略图标 (50x50, 这里的icon指每张表情的缩略图,非聊天页单一图标) -
meta.txt: 含义词配置表 (格式:01.png [请输入表情含义]) -
info.txt: 专辑信息模板 (包含名称、简介模板) -
cover_candidate.png: 封面图候选 (240x240, 取自第1张) -
chat_icon_candidate.png: 聊天页图标候选 (50x50, 取自第1张)
输出目录自定义: Agent 在调用脚本时应传入 --output 参数:如果用户指定了路径,则使用用户指定的路径;如果未指定,则默认使用 output/stickers_[theme] 格式的路径。生成完毕后,向用户呈报生成在该目录下的具体文件路径与文件预览。
重要:自动完善元数据 (Meta-Data Auto-Population) 当运行完本脚本后,Agent 必须根据所生成的表情包主题、画面内容或所使用的模板,自动修改并填充 info.txt 与 meta.txt 中的占位符: 1. 补充 `info.txt`:
- 【表情名称】:结合主题起一个生动的名字(不超过8个汉字,无标点)。
- 【表情介绍】:描述这套表情包的风格和适用场景(不超过80个汉字)。
- 【一句话简介】:提炼一个吸睛的宣传语(不超过11个汉字,无标点)。
2. 补充 `meta.txt`:
- 将每一行的
[请输入表情含义]替换为该表情图对应的具体动作或情绪含义(如:01.png 收到、02.png 摸鱼等,通常为 2-4 个字)。
规范参考
WeChat Sticker Maker (微信表情包制作助手)
这是一个专为 Agent 流程设计的 Skill,旨在将设计好的网格拼图(如九宫格、六宫格)高效转换为符合微信表情开放平台提交规范的完整素材包。
🧩 核心原理
本 Skill 基于 Python 的图像处理库 Pillow 构建,核心处理流程如下:
1. 智能布局探测 (Layout Detection):
- 脚本会根据输入图片的宽高比 (Aspect Ratio) 自动推断网格布局。
- 例如:宽高比接近 1:1 识别为 3x3 (九宫格);接近 2:3 识别为 3x2 (六宫格) 等。
- 也支持通过参数强制指定布局(如
2x3,3x4)。
2. 精确切分 (Precision Slicing):
- 根据计算出的行列数,使用浮点数坐标运算,精确地将原图切割为独立的单元格,避免累积误差。
3. 规范化处理 (Normalization):
- 主图生成: 将切片统一缩放至微信要求的 240x240 像素,输出为 PNG 格式。
- 图标生成: 同步生成 50x50 像素的缩略/聊天页图标。
- 候选素材: 自动提取第一张表情作为“表情专辑封面”和“聊天页图标”的候选图。
4. 元数据脚手架 (Metadata Scaffolding):
- 自动生成
meta.txt: 预填充文件列表,留出“含义词”填写位。 - 自动生成
info.txt: 提供符合字数限制的“名称”、“简介”模板。
� 目录结构
Skill 的文件组织结构如下:
skills/wechat-sticker-maker/
├── README.md # 本说明文档
├── SKILL.md # Agent Skill 定义及规范引用
├── requirements.txt # Python 依赖 (Pillow)
└── scripts/
└── make_stickers.py # 核心处理脚本运行脚本后,生成的输出目录(默认或指定)结构如下:
output/stickers_[theme]/
├── cover_candidate.png # [候选] 专辑封面/头像 (240x240)
├── chat_icon_candidate.png # [候选] 聊天页图标 (50x50)
├── info.txt # 专辑信息模板 (名称/简介)
├── meta.txt # 含义词填写表
├── main/ # 表情主图目录 (01.png, 02.png...)
└── icon/ # 聊天图标目录 (01.png, 02.png...)💡 最佳实践
为了获得最佳的输出效果,建议遵循以下流程:
1. 素材准备
- 源文件: 建议使用 透明背景的 PNG 图片作为输入源。如果源文件是不透明的 JPG,生成的表情包也会带有背景,不仅不美观,还可能不符合“去底”的建议规范。
- 分辨率: 尽量保证源图分辨率足够高。例如做一个九宫格(3x3),源图尺寸建议至少为
720x720(即每个格子 240x240),以确保缩放后清晰度。 - 安全区: 设计时注意每个格子的主要内容尽量居中,避免贴边,以免视觉上显拥挤。
2. 高效工作流
1. 触发 Skill: 让 Agent 处理你的网格拼图。 2. 完善信息: 打开生成的 meta.txt,快速填入每个表情的含义(如“收到”、“谢谢”)。打开 info.txt 填入专辑名称和简介。 3. 最终检查: 查看 cover_candidate.png 和 chat_icon.png,如果第一张图不适合做封面,可以手动选择其他生成的图片重命名替换。 4. 打包上传: 此时你拥有了上传所需的所有规范素材。
🗣️ 自然语言调用示例
在 Agent 环境(如 Claude Code 或 Antigravity)中,你可以使用自然语言直接调用此能力。以下是一些典型的 Prompt 场景:
场景一:全自动处理
User: "我画了一张九宫格的图 my_design.png,帮我把它转换成微信表情包素材。" Agent: (自动识别文件,运行脚本,生成所有素材及 info/meta 文件)
场景二:指定布局
User: "这个 funny_cats.jpg 是一个 2行4列 的拼图,请帮我切分并生成符合微信规范的表情包。" Agent: (调用时补充参数 --layout 2x4)
场景三:生成及后续指引
User: "制作微信表情包需要准备哪些东西?帮我用这张图生成一份草稿。" Agent: (生成素材,并解释生成的 info.txt 和 meta.txt 用途,指导用户填写含义词)
---
🛠️ 命令行使用
如果你希望手动运行脚本:
# 自动探测布局
python3 skills/wechat-sticker-maker/scripts/make_stickers.py /path/to/image.png
# 强制指定布局
python3 skills/wechat-sticker-maker/scripts/make_stickers.py /path/to/image.png --layout 3x3
# 指定输出目录 (默认为 sticker_output)
python3 skills/wechat-sticker-maker/scripts/make_stickers.py /path/to/image.png --output ./my_stickers_outputPillow>=9.0.0
import sys
import os
import argparse
from PIL import Image
def determine_layout(img_width, img_height):
"""
根据宽高比猜测网格布局
"""
ratio = img_width / img_height
# 宽高接近 -> 3x3 (9宫格) 或 2x2 (4宫格)
if 0.9 < ratio < 1.1:
return 3, 3
# 竖屏 2:3 -> 3行2列 (6宫格 竖排)
if 0.6 < ratio < 0.75:
return 3, 2
# 横屏 3:2 -> 2行3列 (6宫格 横排)
if 1.3 < ratio < 1.6:
return 2, 3
# 竖屏 3:4 -> 4行3列 (12宫格)
if 0.7 < ratio < 0.8:
return 4, 3
# 横屏 4:3 -> 3行4列 (12宫格)
if 1.25 < ratio < 1.4:
return 3, 4
print(
f"Warning: Cannot auto-detect layout for ratio {ratio:.2f}. Defaulting to 3x3."
)
return 3, 3
def process_image(image_path, layout_str, output_dir):
if not os.path.exists(image_path):
print(f"Error: File not found: {image_path}")
sys.exit(1)
try:
img = Image.open(image_path)
# Ensure image is RGBA to verify transparency is handled correctly
# This prevents P-mode (palette) images from turning black on resize/save
img = img.convert("RGBA")
except Exception as e:
print(f"Error opening image: {e}")
sys.exit(1)
width, height = img.size
print(f"Image Size: {width}x{height}")
if layout_str:
try:
rows, cols = map(int, layout_str.lower().split("x"))
except ValueError:
print("Error: Layout must be in format ROWSxCOLS (e.g. 3x3)")
sys.exit(1)
else:
rows, cols = determine_layout(width, height)
print(f"Layout: {rows} rows x {cols} cols (Total {rows * cols})")
cell_width = width / cols
cell_height = height / rows
# Create directories
main_dir = os.path.join(output_dir, "main")
icon_dir = os.path.join(output_dir, "icon")
os.makedirs(main_dir, exist_ok=True)
os.makedirs(icon_dir, exist_ok=True)
meta_file = os.path.join(output_dir, "meta.txt")
info_file = os.path.join(output_dir, "info.txt")
meta_lines = []
count = 0
total = rows * cols
for r in range(rows):
for c in range(cols):
count += 1
# Accurate floating point crop box
left = c * cell_width
upper = r * cell_height
right = (c + 1) * cell_width
lower = (r + 1) * cell_height
box = (left, upper, right, lower)
# Crop
cell = img.crop(box)
# Stickers: 240x240 (Expression Image)
sticker = cell.resize((240, 240), Image.Resampling.LANCZOS)
sticker.save(os.path.join(main_dir, f"{count:02d}.png"), "PNG")
# Icons: 50x50 (Chat Page Icon)
icon = cell.resize((50, 50), Image.Resampling.LANCZOS)
icon_path = os.path.join(icon_dir, f"{count:02d}.png")
icon.save(icon_path, "PNG")
# Save candidates from the first sticker (01.png)
if count == 1:
# Cover Candidate (240x240) - Same as main sticker
# Note: Official spec requires transparent background, no square borders.
# Our crop is rectangular/square. User needs to ensure source is transparent/appropriate.
cover_candidate_path = os.path.join(output_dir, "cover_candidate.png")
sticker.save(cover_candidate_path, "PNG")
# Chat Icon Candidate (50x50) - Same as icon
# Note: Official spec: Headshot preferred, no white border.
chat_icon_candidate_path = os.path.join(
output_dir, "chat_icon_candidate.png"
)
icon.save(chat_icon_candidate_path, "PNG")
# Add to meta lines
meta_lines.append(f"{count:02d}.png\t[请输入表情含义]")
if count % 3 == 0:
print(f"Processed {count}/{total}...")
print(f"Success! Generated {count} items.")
print(f" - Main Stickers (240x240): {main_dir}")
print(f" - Chat Icons (50x50): {icon_dir}")
# Write meta file
with open(meta_file, "w", encoding="utf-8") as f:
f.write("\n".join(meta_lines))
print(f" - Meta Info (Meanings): {meta_file}")
# Write info file (Name, Intro)
info_content = """=== 微信表情专辑信息模板 ===
【表情名称】 (必填, 不超8个汉字, 无标点):
【表情介绍】 (必填, 不超80个汉字):
【一句话简介】 (必填, 不超11个汉字, 无标点):
=== 图片素材要求 ===
1. [头像/封面图] (240x240, PNG, 透明背景): 已自动生成候选图 cover_candidate.png (取自第1张)
2. [聊天页图标] (50x50, PNG, 透明背景): 已自动生成候选图 chat_icon_candidate.png (取自第1张)
"""
with open(info_file, "w", encoding="utf-8") as f:
f.write(info_content)
print(f" - Album Info Template: {info_file}")
# Generate candidate Cover and Chat Icon from the first processed cell
# Re-open the first image crop to avoid holding all in memory if possible,
# but here we can just do it if we are still inside the loop?
# Actually, let's just do it after the loop using the last 'cell' is risky if loop didn't run.
# Safe way: Process the first cell again or save it during loop.
pass
if __name__ == "__main__":
parser = argparse.ArgumentParser(description="WeChat Sticker Slicer")
parser.add_argument("image", help="Path to the source grid image")
parser.add_argument(
"--layout", help="Grid layout, e.g., '3x3', '2x3'. If ignored, auto-detects."
)
parser.add_argument(
"--output", default="sticker_output", help="Output directory path"
)
args = parser.parse_args()
process_image(args.image, args.layout, args.output)
#!/bin/bash
set -e
# Get the directory where this script is located
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
SKILL_ROOT="$(dirname "$SCRIPT_DIR")"
VENV_DIR="$SKILL_ROOT/.venv"
REQUIREMENTS_FILE="$SKILL_ROOT/requirements.txt"
PYTHON_SCRIPT="$SCRIPT_DIR/make_stickers.py"
# Colors for output
GREEN='\033[0;32m'
BLUE='\033[0;34m'
NC='\033[0m' # No Color
log_info() {
echo -e "${BLUE}[INFO]${NC} $1"
}
log_success() {
echo -e "${GREEN}[SUCCESS]${NC} $1"
}
# 1. Check/Create Virtual Environment
if [ ! -d "$VENV_DIR" ]; then
log_info "Creating virtual environment at $VENV_DIR..."
python3 -m venv "$VENV_DIR"
log_success "Virtual environment created."
fi
# 2. Install Dependencies
# We use a marker file to avoid running pip install every time if requirements haven't changed
# But for simplicity and robustness, we'll just run pip install (pip is fast if satisfied)
PYTHON_BIN="$VENV_DIR/bin/python"
PIP_BIN="$VENV_DIR/bin/pip"
log_info "Checking dependencies..."
"$PIP_BIN" install -q -r "$REQUIREMENTS_FILE"
# 3. Run the valid script
log_info "Running sticker maker..."
"$PYTHON_BIN" "$PYTHON_SCRIPT" "$@"