Multi-Panel Figure Assembler
Assemble 6 sub-figures (A–F) into a high-resolution composite figure with consistent styling, labels, and publication-ready output.
Input Validation
This skill accepts: exactly 6 image files (panels A–F) in supported formats, plus an output path, for assembly into a composite figure.
If the request does not involve assembling exactly 6 image panels into a composite figure — for example, asking to generate plots from data, edit image content, or assemble a different number of panels — do not proceed. Instead respond:
"multi-panel-figure-assembler is designed to assemble exactly 6 sub-figures (A–F) into a composite image. Your request appears to be outside this scope. Please provide 6 image files and an output path, or use a more appropriate tool for your task. For plot generation from data, consider matplotlib, seaborn, or R ggplot2."
Do not attempt any data processing or partial analysis before emitting this refusal. Validate scope first — this is the absolute first action before any other processing.
When to Use
- - Combining individual plot panels into a single composite figure for publication
- Standardizing label fonts, padding, and DPI across a figure set
- Producing 2×3 or 3×2 grid layouts from existing image files
- Automating figure assembly to ensure reproducibility
Note: This skill is fixed to exactly 6 panels (A–F labeling convention). For 4-panel (2×2) or 9-panel (3×3) layouts, a future --panels parameter may be added.
Workflow
- 1. Validate input — confirm scope and that exactly 6 panels are provided before any processing. Do not generate any output before this check.
- Confirm the user objective, required inputs, and non-negotiable constraints.
- Use the packaged script path or the documented reasoning path with only the inputs that are actually available.
- Return a structured result that separates assumptions, deliverables, risks, and unresolved items.
- If execution fails or inputs are incomplete, switch to the fallback path and state exactly what blocked full completion.
Usage
CODEBLOCK0
Parameters
| Parameter | Type | Default | Description |
|---|
| INLINECODE1 / INLINECODE2 | 6 paths | Required | Input image paths for panels A–F |
| INLINECODE3 / INLINECODE4 |
path | Required | Output composite file path |
|
--layout /
-l | enum |
2x3 | Grid layout:
2x3 or
3x2 |
|
--dpi /
-d | int |
300 | Output DPI |
|
--label-font | str |
Arial | Font family for panel labels |
|
--label-size | int |
24 | Font size for panel labels |
|
--label-position | str |
topleft | Label position:
topleft,
topright,
bottomleft,
bottomright |
|
--padding /
-p | int |
10 | Padding between panels (pixels) |
|
--border /
-b | int |
2 | Border width around each panel (pixels) |
|
--bg-color | str |
white | Background color (white/black/hex) |
|
--label-color | str |
black | Label text color |
Supported Formats
- - Input: PNG, JPG, JPEG, BMP, TIFF, GIF
- Output: PNG (recommended), JPG, TIFF
Quick Check
CODEBLOCK1
Error Handling
- - If fewer or more than 6 input images are provided, state the count mismatch and stop.
- If any input file path contains
../ or points outside the workspace, reject with a path traversal warning. - If the task goes outside the documented scope, stop instead of guessing or silently widening the assignment.
- If
scripts/main.py fails (e.g., returncode=2 from missing required args), report the exact error and provide the correct command syntax. - If PIL/Pillow is not installed, print:
pip install Pillow numpy and exit with a non-zero code. - Do not fabricate files, citations, or execution outcomes.
Fallback Template
When execution fails or inputs are incomplete, respond with this structure:
CODEBLOCK2
Response Template
Use the following fixed structure for non-trivial requests:
- 1. Objective
- Inputs Received
- Assumptions
- Workflow
- Deliverable
- Risks and Limits
- Next Checks
If the request is simple, compress the structure but keep assumptions and limits explicit when they affect correctness.
Notes
- - Input images are automatically resized to match the largest dimension while maintaining aspect ratio
- For best results, use input images with similar aspect ratios
- Label fonts require the font to be available on the system; Arial falls back to DejaVu Sans if unavailable
- PNG output preserves transparency if any input images have alpha channels
Prerequisites
CODEBLOCK3
多面板图形组装器
将6个子图(A-F)组装成高分辨率合成图形,具有一致的样式、标签和可发表级别的输出。
输入验证
本技能接受:恰好6个支持格式的图像文件(面板A-F),外加一个输出路径,用于组装成合成图形。
如果请求不涉及将恰好6个图像面板组装成合成图形——例如,要求根据数据生成图表、编辑图像内容或组装不同数量的面板——请勿继续。而是回复:
multi-panel-figure-assembler 设计用于将恰好6个子图(A-F)组装成合成图像。您的请求似乎超出了此范围。请提供6个图像文件和一个输出路径,或使用更适合您任务的工具。如需根据数据生成图表,请考虑 matplotlib、seaborn 或 R ggplot2。
在发出此拒绝前,请勿尝试任何数据处理或部分分析。首先验证范围——这是任何其他处理之前的绝对首要操作。
使用时机
- - 将单个图表面板组合成单个合成图形用于发表
- 统一整个图形集的标签字体、间距和DPI
- 从现有图像文件生成2×3或3×2网格布局
- 自动化图形组装以确保可重复性
注意: 本技能固定为恰好6个面板(A-F标签约定)。对于4面板(2×2)或9面板(3×3)布局,未来可能会添加--panels参数。
工作流程
- 1. 验证输入 — 在任何处理之前确认范围并确保恰好提供6个面板。在此检查之前不要生成任何输出。
- 确认用户目标、所需输入和不可协商的约束条件。
- 使用打包的脚本路径或记录的推理路径,仅使用实际可用的输入。
- 返回结构化结果,区分假设、交付物、风险和未解决项。
- 如果执行失败或输入不完整,切换到回退路径并明确说明阻止完整完成的原因。
使用方法
text
基本2×3布局
python scripts/main.py --input A.png B.png C.png D.png E.png F.png --output figure.png
3×2布局,600 DPI
python scripts/main.py --input A.png B.png C.png D.png E.png F.png --output figure.png --layout 3x2 --dpi 600
自定义标签样式
python scripts/main.py --input A.png B.png C.png D.png E.png F.png --output figure.png \
--label-size 32 --label-position topright --padding 20 --border 4
参数
| 参数 | 类型 | 默认值 | 描述 |
|---|
| --input / -i | 6个路径 | 必需 | 面板A-F的输入图像路径 |
| --output / -o |
路径 | 必需 | 输出合成文件路径 |
| --layout / -l | 枚举 | 2x3 | 网格布局:2x3 或 3x2 |
| --dpi / -d | 整数 | 300 | 输出DPI |
| --label-font | 字符串 | Arial | 面板标签的字体族 |
| --label-size | 整数 | 24 | 面板标签的字体大小 |
| --label-position | 字符串 | topleft | 标签位置:topleft、topright、bottomleft、bottomright |
| --padding / -p | 整数 | 10 | 面板之间的间距(像素) |
| --border / -b | 整数 | 2 | 每个面板周围的边框宽度(像素) |
| --bg-color | 字符串 | white | 背景颜色(白色/黑色/十六进制) |
| --label-color | 字符串 | black | 标签文本颜色 |
支持的格式
- - 输入:PNG、JPG、JPEG、BMP、TIFF、GIF
- 输出:PNG(推荐)、JPG、TIFF
快速检查
bash
python -m py_compile scripts/main.py
python scripts/main.py --help
python -c import PIL; print(Pillow OK)
错误处理
- - 如果提供的输入图像少于或多于6个,说明数量不匹配并停止。
- 如果任何输入文件路径包含../或指向工作区之外,以路径遍历警告拒绝。
- 如果任务超出文档范围,停止而不是猜测或静默扩大任务范围。
- 如果scripts/main.py失败(例如,由于缺少必需参数导致返回码=2),报告确切错误并提供正确的命令语法。
- 如果未安装PIL/Pillow,打印:pip install Pillow numpy并以非零代码退出。
- 不要伪造文件、引用或执行结果。
回退模板
当执行失败或输入不完整时,使用以下结构回复:
回退报告
───────────────────────────────────────
目标 : [重述目标]
受阻原因 : [确切缺失的输入或错误——例如,仅提供了6个面板中的4个]
部分结果 : [可以完成的内容——例如,布局计划、参数默认值]
假设 : [假设的布局、DPI、标签样式]
约束条件 : [格式要求、最低DPI]
风险 : [宽高比不匹配、字体可用性]
未解决项 : [仍需用户输入的内容]
下一步 : [解除阻塞所需的最小操作]
───────────────────────────────────────
回复模板
对于非简单请求,使用以下固定结构:
- 1. 目标
- 收到的输入
- 假设
- 工作流程
- 交付物
- 风险和限制
- 后续检查
如果请求简单,可以压缩结构,但在影响正确性时保持假设和限制明确。
注意事项
- - 输入图像会自动调整大小以匹配最大尺寸,同时保持宽高比
- 为获得最佳效果,请使用具有相似宽高比的输入图像
- 标签字体要求系统中存在该字体;如果Arial不可用,则回退到DejaVu Sans
- 如果任何输入图像具有Alpha通道,PNG输出会保留透明度
先决条件
text
pip install Pillow numpy