- name
SKILL.md
El archivo de la skill permanece en el repositorio del publicador.
Pega el comando copiado en una terminal. Instala este SKILL.md en ese agente.
npx skills add yan-labs/yan-skills --skill imagegen -a cursor -yPega el comando copiado en una terminal. Instala este SKILL.md en ese agente.
npx skills add yan-labs/yan-skills --skill imagegen -a claude-code -yPega el comando copiado en una terminal. Instala este SKILL.md en ese agente.
npx skills add yan-labs/yan-skills --skill imagegen -a codex -yPega el comando copiado en una terminal. Instala este SKILL.md en ese agente.
npx skills add yan-labs/yan-skills --skill imagegen -a grok -yEnvía el mensaje copiado en un chat de Grok Bot. El Bot obtiene este SKILL.md de GitHub y lo añade a las skills que comparten todos tus Bots.
Install this skill: https://github.com/yan-labs/yan-skills/tree/HEAD/imagegenDel publicador
一句话定位:静图用 Codex 内置图像生成,GIF 用 Kollab GPT Image 2.6;本 Skill 只管五件事——把需求翻成好提示词、把命令跑通、验收、压缩、放进项目该在的目录。
图像生成不是 CLI 子命令(没有 codex image;codex exec --image 是把图当输入附上)。它是 Codex agent 的内置工具 image_gen。不要翻 codex --help 找 flag,找不到就下结论"不能生图"——这个结论是错的。描述你要的图,让 agent 自己选方法。
mkdir -p <outdir> # 先建目录,提示词里写它的绝对路径
cat <outdir>/prompt.md | codex exec --skip-git-repo-check \
--config model_reasoning_effort="medium" \
--sandbox danger-full-access \
-C <outdir> -o <outdir>/final.md 2>/dev/null
codex --version 失败或启动就退出:先 codex doctor,如实报告,不要盲目重试。
官网和更新日志需要展示动作或变化时优先用动图;静态素材继续走上面的内置 image_gen。GPT Image 2.6 经 Kollab 的 gpt-image-2 调用,生成和编辑支持 GIF,编辑 GIF 不支持 mask。生产是否可用以 fleet media list 为准;未发布时用 TEST,进程级设置 KOLLAB_API_URL=https://test.flowus.work 和独立 TEST 会话,勿覆盖生产 profile。
提示词写清首尾无缝循环、动作幅度和方向、固定镜头、帧间造型/颜色/位置连贯,主体不跳、不变形;避免文字。先用 9 帧、每帧 200ms(默认)做短循环;允许 2–16 帧、每帧 20–2000ms,按动作速度调整,帧越多通常体积越大。TEST 实测请求 2 帧曾返回默认 9 帧,落盘后检查实际帧数与时长。
fleet media run generate_image --model gpt-image-2 \
--input-json '{"prompt":"A blue paper bird gently flaps in place, seamless loop, fixed camera, consistent subject, no text","output_format":"gif","frame_count":9,"frame_duration_ms":200}' \
--out <outdir>
生成后保留原始 GIF 和提示词到 <project>/design/imagegen/<batch>/,发布版本放 <project>/public/images/<section>/;网页动图目标尽量小于 2 MB,超出先缩尺寸或帧数。已有 gifsicle 或 ffmpeg 时再压缩,并检查循环、帧时长和画质;MacBook 不安装软件。保留 GIF 格式,不用静图压缩命令覆盖。
三道验收用于动图:逐帧抽查并看完整循环(含首尾衔接),将代表帧缩到 120px 做接触印相;透明主体逐帧量 alpha 包围盒占比(不透明图不适用);独立盲评播放结果和代表帧,对照提示词检查连贯、主体不跳及风格。单一方案无对照时如实记录盲评未做。
一份 prompt.md 必含六样,缺一样就会出一类问题:
mkdir -p)。No text, no letters, no logos, no watermarks. 生成的字几乎必花,非英文界面更是错字;文字后期用 HTML/CSS 叠。If you genuinely cannot generate images, say so plainly. Do not substitute placeholders, ASCII art, solid rectangles, or images downloaded from the web.透明图务必写 true alpha, not a white/dark square——实测 Codex 靠这句自检,第一版烤了底色又自己返工。
再加一条常用兜底:If the exact size is unsupported, generate the nearest aspect and resize locally (sips / PIL) to the exact pixels; keep alpha for transparent items.
Generate two images with your built-in image generation tool and save them to:
<outdir absolute path>/
Shared style: palette #2563EB (primary) #F59E0B (accent) #0F172A (ink) #F8FAFC (paper).
No text, no letters, no logos, no watermarks anywhere.
1. `mascot-logo.png` — 1024x1024, transparent background PNG (true alpha, not a white square).
A friendly round owl holding a tiny wrench. Flat vector style, bold clean shapes,
2-3 flat tones per element, no gradients, no drop shadows. Occupies 75-80% of the
frame, centered, exclude the wrench from that measure.
2. `og-image.png` — 1200x630 (1.91:1), opaque. Photorealistic editorial photo: a person
in their late twenties at a wooden desk in front of a laptop, soft window light from
the left, shallow depth of field, calm home office, mug and small plant. Eye-level,
subject on the left so the right third is clean negative space. Laptop screen is a
soft blurred blue-white glow, nothing readable.
Rules: if you genuinely cannot generate images, say so plainly — no placeholders, ASCII
art, solid rectangles, or web downloads. If the exact size is unsupported, generate the
nearest aspect and resize locally (sips / PIL); keep alpha for the mascot.
Report per file: absolute path, actual pixels, bytes, alpha yes/no, method used.
尺寸比例写清,模型给不了精确像素时靠本地缩放,见「压缩与落盘」。
出处:codex/references/image-experiments.md「一套图的验收」,2026-08-22 一次 16 张角色图的实录,三道各自抓到了不同缺陷。
先用 Read 逐张打开看过,再谈下面三道;没看过的图不准接进页面。三道都是必做,缺一道漏一类问题。
sips -Z 120 in.png --out thumbs/in.pngfrom PIL import Image
im = Image.open(f).convert('RGBA'); bb = im.getchannel('A').getbbox()
frac = (bb[2]-bb[0])*(bb[3]-bb[1]) / (im.width*im.height) # 目标 0.75–0.80
实测一组六张 41%–66%,没有一张达标且相差 1.6 倍,并排看只觉得"有点乱"。提示词里除了写占比还要写明道具不计入。pairN-A/B,对照表放项目目录之外,派一个没参与生成的 agent 评,明说「看不出差别」可接受。非盲判断曾被盲评整组反转,机制是多出来的道具。风格不受版权保护,喂参考图是设计行业的常规做法。控制点在输出端,不在输入端:
原图约 1 MB/张 PNG,不压缩不许进仓库。
sips -s format jpeg -s formatOptions 82 in.png --out out.jpg # 不透明图:JPEG,4 MB 一套压到 1 MB 内
cwebp -q 82 in.png -o out.webp # 页内用 WebP(透明也保留)
cwebp -q 82 -alpha_q 100 mascot.png -o mascot.webp # 透明主体,alpha 无损
sips -Z 512 logo.png --out icon-512.png # 等比缩最长边
sips -z 630 1200 og.png --out og.png # 精确到像素(先高后宽)
透明没做出来、或主体占比不达标时,用 ImageMagick 二次处理(先 which magick,没有就 brew install imagemagick):
magick in.png -fuzz 8% -transparent '#0F172A' out.png # 纯色底抠透明(换成实际底色 hex)
magick in.png -trim +repage -resize 800x800 -gravity center \
-background none -extent 1024x1024 out.png # 裁掉空边,主体缩到约 78% 再居中回 1024²
magick out.png -format 'alpha_min=%[fx:minima.a] colors=%k\n' info: # alpha_min 必须是 0 才算真透明
python3 heredoc 驱动:Claude Code 的 Bash tool 里裸 for f in *.png; do …; done 和 until [ -f x ]; do sleep 2; done 可能报 parse error near 'done'(2026-09-02 在一台 macOS zsh 环境实测),用 heredoc 最稳。filter: brightness(.84) saturate(.92)。curl -I 每张图 200;仓库结构迁移后 favicon/og 静默 404 是踩过的坑。rankup/SKILL.md 段 3(建站)硬规则和「一句话落到哪一段」表都指到 /imagegen:网站需要任何视觉素材就来这里真实生成。placeholder、模板示例图),Google 据此判垃圾站、整站连坐;段 4 硬规则:每页独立 og:image 且必须有图,≥1200px 宽,全站共用一张不通过。两条叠加,没有生成能力就只剩占位一条路——所以出图是建站流程的固定环节,不是可选美化。checklists.md 段 3「无占位红线」、段 4「每页独立 title/description/og:image 且有图」、闸门 0 图标全集与 manifest.json 引用全真实、标记经 16px 实测。og:image / twitter:image 用 PNG/JPEG,页内 <img>、JSON-LD image、image-sitemap 用 WebP。codex --help 找不到 image flag 就宣布"Codex 不能生图"。codex exec 让用户干等;或紧密轮询后台 shell。--sandbox danger-full-access 反复请示——按该机器的规则处理一次,启动行披露即可。Read 打开过就把图接进页面;或把未压缩的多 MB 原图提交进仓库。run_in_background: true 跑 codex exec——subagent park 后 harness 判定其空闲并终止,完成通知永远送不到,图生成了但没人收。必须从主线程跑 codex exec(Bash 的 run_in_background: true),主线程能正确接收完成通知;或者 subagent 内改用前台同步等待(但会占用 subagent 上下文数分钟)。2026-09-11 同一批任务因此重试三次。-o final.md 拿最终报告。exit 0,无报错,总耗时 302 s(约 5 分钟)。image_gen 工具(日志里出现 gpt-image-1.5 / gpt-image-2 字样,Codex 自报「具体模型名未公开」);本轮共调了 9 次,原图全部落在 ~/.codex/generated_images/<session-id>/exec-*.png,每张 0.7–1.5 MB。最终文件是它用 ImageMagick(magick,本机 7.1.2)后处理得到的:吉祥物 resize → -remap 锁定提示词里的四个 hex → alpha 提取;og 图轻微居中裁切缩到精确 1200×630。要没被后处理过的原图去 generated_images/ 拿。og-image.png 1200×630 RGB 757 KB,构图、光线、屏幕模糊无字全部按要求;mascot-logo.png 1024×1024 RGBA 33 KB(四色量化),真透明——57% 像素 alpha=0,alpha 极值 (0,255)。mascot-logo.png,alpha 全 255、深蓝底被烤进去了;Codex 自己又跑了两轮才在第 5 分钟做出真透明。教训两条:① final.md / 退出码出来之前别量图,中间态会误判;② 提示词里 true alpha, not a white/dark square 这句要写,它确实靠这句自检。若最终仍不透明,按「压缩与落盘」的 ImageMagick 抠底命令二次处理,不要写成功。-trim 后按目标占比 -resize 再 -extent 回 1024²。sips JPEG q82 92 KB → cwebp q82 27 KB;四色量化的透明 PNG 33 KB → WebP 反而 48 KB,已量化的扁平透明 PNG 直接用,不转 WebP。sips -Z 120 两张均可辨主体;盲评本次未做(单张无对照)。当用户要求生成图片、动图、GIF、gif 图、配图、插图、logo、吉祥物、封面、海报、og 图、favicon 源图、真人场景图,或建站时页面缺图、仍有占位图时使用。包括“画一张”“出一套图”“网站需要配图”“image gen”。本 Skill 负责提示词、生成、三道验收、压缩与落盘;只是让 Codex CLI 做代码代理任务时用 codex,普通派单走 agent-fleet,页面 SEO
---name: imagegendescription: 当用户要求生成图片、动图、GIF、gif 图、配图、插图、logo、吉祥物、封面、海报、og 图、favicon…---# imagegen/SKILL.mdResumen general
当用户要求生成图片、动图、GIF、gif 图、配图、插图、logo、吉祥物、封面、海报、og 图、favicon 源图、真人场景图,或建站时页面缺图、仍有占位图时使用。包括“画一张”“出一套图”“网站需要配图”“image gen”。本 Skill 负责提示词、生成、三道验收、压缩与落盘;只是让 Codex CLI 做代码代理任务时用 codex,普通派单走 agent-fleet,页面 SEO 与上线闸门走 rankup。
Preguntas frecuentes
Descarga imagegen/SKILL.md desde el publicador, o copia la ruta y abre el repositorio. PlugMCP lista la skill y no aloja el archivo.
El publicador lo mantiene en https://github.com/yan-labs/yan-skills.
Claude, Cursor, Codex y Grok Build pueden leer un SKILL.md que añadas desde el repositorio del publicador. Grok Bot lo instala cuando envías en un chat el enlace a la carpeta de la skill en GitHub.