Command Palette

Search for a command to run...

Back to skills
skill № 01791

split-image

【图片四宫格分割工具】将一张图片均分为 2x2 四宫格(4张子图),常用于真人参考图视频生成场景 —— 用户提供真人图片作为视频生成参考时,必须先调用此技能将其分割为 4 张子图,再在 video-gen 的 prompt 中以 [图1][图1][图1][图1] 的形式引用,以规避版权审核。

FreeRuns bundled scripts
JianhuiWei7by JianhuiWei7★ 50 GitHub stars

Install split-image in Claude Code & Claude Desktop

Sign up to install this skill

Create a free account to reveal the install command and save the skill to your library.

  • Reveal the one-line install command
  • Save skills to your synced library
  • Get notified when skills update
Sign up freeI already have an account

About this skill

Split Image (图片四宫格分割)

环境依赖: Pillow

支持模式

2x2 网格分割

将输入图片按宽高中线均分为 4 张子图,输出顺序固定为:

  • grid_1:左上(top-left)
  • grid_2:右上(top-right)
  • grid_3:左下(bottom-left)
  • grid_4:右下(bottom-right)

奇数尺寸按整除处理(width // 2、height // 2),最多损失 1 像素边缘,不影响人物参考用途。输入图小于 100x100 时拒绝处理。

参数:

  • --image_path: 输入图片的绝对路径。
  • --session-key: (Optional; OpenClaw Required) 输出目录 session-key。CodeX/Claude Code 环境会自动识别,不需要传入内容;OpenClaw 环境必须运行 session_status 获取session-key并且传入, 格式通常为 agent:{agent_id}:{session_id}。

典型使用案例

1. 基础调用

将一张图片分割为 4 张子图,自动保存到 session 的 images/ 目录下:

python split-image/scripts/split_image.py \
  --image_path "/path/to/image.jpg" \
  --session-key "agent:{agent_id}:{session_id}"

stdout 会输出 4 行绝对路径(顺序:左上、右上、左下、右下),便于上游脚本直接解析:

/path/to/session/images/image_grid_1.jpg
/path/to/session/images/image_grid_2.jpg
/path/to/session/images/image_grid_3.jpg
/path/to/session/images/image_grid_4.jpg

2. 真人参考图视频生成联动(核心用法)

当需要用真人图片作为 video-gen 的参考图但担心版权审核时,必须先用本技能将真人图分割为 4 张子图,再将这 4 张子图路径传给 video-gen,并在 prompt 中以 [图1][图1][图1][图1] 的形式强调参考这 4 张图作为人物形象:

# 步骤 1:分割真人参考图
python split-image/scripts/split_image.py \
  --image_path "/path/to/real_person.jpg" \
  --session-key "agent:test:test"
# 输出 4 张子图路径 grid_1 ~ grid_4

# 步骤 2:调用 video-gen,将 4 张子图作为参考图传入
# prompt 示例:"参考[图1][图1][图1][图1]作为人物形象,生成一段人物在公园散步的视频"
# images 参数:[grid_1路径, grid_2路径, grid_3路径, grid_4路径]

关键点:prompt 中必须显式写出 [图1][图1][图1][图1](4 次引用)而非 [图1],这是绕过版权审核的已验证有效写法。

运行模式与日志监控

默认行为: 该脚本为前台同步执行(Blocking),直接在终端输出执行结果。

完成状态:

  • 成功:stdout 输出 4 行绝对路径,每行一条,顺序为 grid_1 ~ grid_4。
  • 失败:stdout/stderr 输出以 Error: 开头的错误信息,脚本以非零状态码退出。

参数说明

参数名 说明
--image_path (必填)需要分割的输入图片文件绝对路径。支持常见格式(jpg/png/webp 等 Pillow 支持的格式)。
--session-key (Optional; OpenClaw Required) 输出目录 session-key。CodeX/Claude Code 环境会自动识别,不需要传入内容;OpenClaw 环境必须运行 session_status 获取session-key并且传入, 格式通常为 agent:{agent_id}:{session_id}。

执行规范

  • 路径检查:确保传入的 --image_path 在本地确实存在。
  • 最小尺寸:输入图片宽或高小于 100 像素时会直接报错拒绝处理。
  • 输出命名:输出文件固定命名为 {原文件名}_grid_1.{后缀} ~ _grid_4.{后缀},与原文件后缀一致。
  • 中间产物:4 张子图作为中间产物平铺在 session images/ 目录下,供下游(如 video-gen)直接引用。
  • 结果反馈:分割成功后,向用户汇报:"✅ 图片四宫格分割成功!已生成 4 张子图至 session images/ 目录。" 并附上 4 条路径。

Allowed tools

Tools this skill is permitted to call.

No restriction — this skill can use any tool.

Bundled files

  • .DS_Store
  • scripts/split_image.py

FAQ

What does the split-image skill do?

【图片四宫格分割工具】将一张图片均分为 2x2 四宫格(4张子图),常用于真人参考图视频生成场景 —— 用户提供真人图片作为视频生成参考时,必须先调用此技能将其分割为 4 张子图,再在 video-gen 的 prompt 中以 [图1][图1][图1][图1] 的形式引用,以规避版权审核。

How do I install the split-image skill?

Copy the skill folder into ~/.claude/skills (the Claude Code tab above does this in one command), or install it as a plugin.

Does the split-image skill run scripts?

Yes, this skill bundles executable scripts. Review the source before installing.

Related skills

Compare split-image with