1实现原理 · 为什么它能做到
流程核心是『视觉证据 → 极简符号映射』的 prompt 编排,而非算法:skill 把生成任务定义成 Deconstruct→Abstract/distill→Reconstruct 三阶段,模型必须先做源图证据清单、再映射为符号、最后重建成稀疏布局。
Treat the task as three deliberate operations: **deconstruct**, **abstract/distill**, and **reconstruct**. The lower panel is a new visual composition made from relationships extracted from the upper photograph. It is neither a miniature redraw nor a style-converted copy.
『解构-重建』由上层生成模型与下层确定性 Python 脚本分工:抽象下面板交给内置图像生成工具,拼图、微字排版与机器校验全部交给自带脚本,防止生成模型篡改照片或产出错误文字。
Supply the image tool with locked `USER_PHOTO` plus 3–4 selected bundled references in one generation call (the tool accepts at most five images total). Label roles explicitly: `Image 1 = USER-UPLOADED CONTENT SOURCE ONLY`; `Images 2–N = BUNDLED LOWER-PANEL STYLE REFERENCES ONLY`. Generate only `GENERATED_PANEL`.
交付物只能由 finalize_artwork.py 产出,它按固定顺序跑 compose_artwork.py 拼图 + validate_output.py 校验,任一步失败即删除输出并拒绝交付(fail-closed)。
try: subprocess.run(compose, check=True) subprocess.run( [sys.executable, str(scripts / "validate_output.py"), str(output), "--original", str(original)], check=True, ) except (subprocess.CalledProcessError, OSError): if output.is_file(): output.unlink() raise SystemExit("FINALIZATION FAILED: invalid output removed; deliver no artwork")
照片像素级完整性由 validate_output.py 机器保证:把最终图顶部裁成与源图同尺寸区域,用 ImageChops.difference 做逐像素比对,要求零差异。
photo_match = None actual = image.crop((0, 0, source.width, source.height)) photo_match = native_dimensions and ImageChops.difference(actual, source).getbbox() is None
三件微字(NO. 00X / DD MON YYYY / 大写短语)用正则硬校验 + 确定性绘制,禁止生成模型在画面里画任何文字。
NUMBER_RE = re.compile(r"^NO\. \d{3}$") DATE_RE = re.compile(r"^\d{2} [A-Z]{3} \d{4}$") PHRASE_RE = re.compile(r"^[A-Z0-9]+(?: [A-Z0-9]+){0,2}$")
19 张打包样式参考图构成『许可的视觉语法库』,与源照片的内容通道严格分离;参考只借抽象语法/疏密/留白,不借内容与旧排版。
Use the selected lower panels to guide abstraction vocabulary, mark-making, scale contrast, restrained color, editorial quietness, and poetic negative space. The current `USER_PHOTO`, not the references, supplies the miniature's complete composition, aspect ratio, topology, and element coordinates. Do not copy reference subjects or exact compositions.
安装自检与运行门禁:check_installation.py 校验全部必需文件与 19 张参考图是否齐全,缺失即 FAIL;SKILL.md 还要求在生成前确认宿主内置图像工具可调用,否则直接停止。
1. Run `scripts/check_installation.py`. Stop and report an incomplete installation if it fails. 2. Confirm that a built-in image generation tool is callable. If it is absent, unavailable, denied, or fails, stop and tell the user.
2核心能力
3外部依赖
| 类型 | 依赖 |
|---|---|
| api | 宿主内置图像生成工具(built-in image generation tool) |
| package | Python Pillow(PIL) |
4风险提醒 风险提醒:蓝色 · 知晓即可
- 照片外发给第三方图像生成平台 — 核心流程就是把用户上传照片作为输入调宿主内置图像工具,照片内容必然离开本地/进入平台处理管线;涉隐私或敏感拍摄物(人像、场所、未发布内容)时用户需自行评估平台条款——skill 内无任何本地化/脱敏选项。
- Pillow 解析不可信图片的宿主库风险 — compose/validate 直接 Image.open 用户上传文件与生成面板并读取 EXIF(exif_transpose);畸形图片触发解码器漏洞属 Pillow 宿主环境通用风险面,skill 无沙箱。
- 输入文件与参考文件混用的操作风险 — 19 张参考图与用户照片同为图像输入,一旦模型/宿主在单次生成调用中角色标签失效,样式参考可能污染内容通道或照片被当作编辑对象;skill 靠 prompt 措辞锁定角色,无机器侧防线(机器只校验最终合成)。
- 纯 prompt 质量门槛高、依赖模型审美 — 『抽象得像这张照片而不是通用图标』的判定最终落在模型与人眼:机器只查像素/背景/文本/比例,抽象质量(证据保留度、关系识别)无法被脚本证明,低质量输出可能『合规但平庸』。
- 许可限制严格 — 自拟 Source-Available License 1.0 禁止修改/衍生/再分发,GitHub API spdx 标 NOASSERTION——想改造或二次发布该 skill 的用户受法律限制,与 MIT/Apache 类 skill 不同。
- 无标注的尺寸矛盾(低级) — README 写选『2–4』张参考、SKILL.md/索引写『3–4』张;两处均可被模型读到(若 agent 先读 README 可能产生轻微不确定),实际以 SKILL.md 为准。
5第二遍独立确认
- [ok] 像素保真由机器验证而非口头承诺 — validate_output.py 第 90 行附近 ImageChops.difference(actual, source).getbbox() is None + native_dimensions 判定,README『pixel-verify』无夸大。
- [ok] finalize_artwork.py 只调兄弟脚本、无外带载荷 — subprocess 参数 = sys.executable + scripts/ 下 compose_artwork.py/validate_output.py + 本地路径与正则校验过的三文本;无 shell=True、无环境变量透传。
- [ok] 无网络调用、无凭证读取结论 — 全仓 token 扫描命中仅两处:README git clone URL(人用安装命令)与 finalize 本地 subprocess;os.environ/getenv/keyring/api_key 等零命中。
- [ok] 19 张样式参考真实存在且为图 — PNG 头逐一验证 memory-reference-001..019.png 均为合法 PNG,竖幅、尺寸各异;check_installation.py 的断言与文件清单一致。
- [ok] 文本三件套仅由确定性脚本添加(生成阶段禁字) — compose_artwork.py 正则 NUMBER_RE/DATE_RE/PHRASE_RE + ImageDraw 绘制;SKILL.md 第 10、11 步与 prompt scaffold『Text: generate no text of any kind』双重印证。
- [ok] 背景 CLEAN 契约可机器核验 — validate_output.py 6 采样点 (0.12,0.18)(0.50,0.18)(0.12,0.48)(0.88,0.48)(0.50,0.88)(0.88,0.88) + channel_span≤4.0 + lower_brightness≥205 判定存在。
- [ok] 依赖清单完备性(有无漏掉 CLI/包) — 可执行代码只用 sys.executable/subprocess 调兄弟脚本与 Pillow(import 处显式报错提示);字体走系统字体候选列表(DejaVuSansMono.ttf/consola.ttf/Menlo.ttc)失败则 fallback load_default,非硬依赖。无 gh/git/ffmpeg/yt-dlp 等外部 CLI。
- [ok] commit/metadata 一致 — git HEAD==96e387635edf==pin;GitHub API:stars 749、pushed_at 2026-08-03T00:24:09Z(与本地最后提交同时刻)、license spdx NOASSERTION(仓库 LICENSE 为自拟 Source-Available 1.0,README 明示非 OSI 开源)。
6结论
013e3c7b5205fbdc…96e387635e