返回 FEED
OTHER2026-05-22

Codex 逆向文生图提示词:双 Agent 协作工作流

Codex 逆向文生图提示词:双 Agent 协作工作流

原文作者:@qc777qc(Bridge Wang) 收录时间:2026-05-22

核心观点

"给 AI 一张封面图,让它反推出背后的提示词。"

难点不是猜出风格词(如"黑黄 cyberpunk manga poster"),而是把画面结构也锁住


实验目标

用 Codex 创建两个子智能体,把任意图片逆向成:

  • ✅ 可复用的提示词
  • ✅ 可测试(能生成相似图片验证)
  • ✅ 可迭代(能逐步优化)

案例:Cyberpunk 封面图

原图元素分析:

元素描述
左侧巨大数字 "276"
标题"USE CASES / OF / HERMES AGENT" 层级
右侧戴耳机的漫画女性
特效黄色圆形光环
界面右侧 HUD 面板
底部六个 icon 标签

双 Agent 工作流

Agent 1:视觉分析器 (Vision Analyzer)

任务:

  • 识别画面中的所有元素
  • 描述元素的位置、大小、颜色
  • 提取风格关键词

输出:结构化元素清单

{
  "elements": [
    {"type": "text", "content": "276", "position": "left", "size": "large"},
    {"type": "text", "content": "USE CASES / OF / HERMES AGENT", "position": "center-left", "style": "hierarchical"},
    {"type": "character", "description": "cyberpunk female with headphones", "position": "right"},
    {"type": "effect", "description": "yellow circular glow", "position": "behind character"}
  ],
  "style": "cyberpunk manga poster",
  "color_scheme": ["black", "yellow", "cyan"]
}

Agent 2:提示词生成器 (Prompt Engineer)

任务:

  • 接收 Agent 1 的结构化分析
  • 生成精确的文生图提示词
  • 确保所有元素都被准确描述
  • 添加技术参数(比例、风格强度等)

输出:完整提示词

A cyberpunk manga poster, black background with yellow and cyan accents.

LEFT SIDE: Large bold white number "276" dominating the left third.

CENTER-LEFT: Hierarchical text layout - "USE CASES" (top, medium), 
"OF" (center, small), "HERMES AGENT" (bottom, large bold), 
all in futuristic sans-serif font.

RIGHT SIDE: Cyberpunk female character with over-ear headphones, 
looking left, detailed anime/manga art style. Behind her: 
bright yellow circular glow effect creating halo.

RIGHT PANEL: HUD-style interface panel with cyan grid lines 
and data readouts.

BOTTOM: Six small icon badges in a row, each with distinct 
symbols inside rounded squares.

Style: High contrast, neon accents, detailed linework, 
professional poster composition. 21:9 aspect ratio.

验证循环

  1. 生成:用提示词生成图片
  2. 对比:与原图并排比较
  3. 找差距:识别缺失或不准的元素
  4. 迭代:调整提示词,重新生成
  5. 重复直到满意

关键技巧

1. 位置锚定

不要只说"有 X 元素",要说"X 在左/右/上/下,占多少比例"。

2. 层级描述

文字元素要说明大小关系和层级:

  • "大标题"
  • "副标题"
  • "正文"
  • "注释"

3. 风格参数分离

把"内容描述"和"风格参数"分开:

  • 内容:有什么
  • 风格:长什么样
  • 技术:比例、分辨率、模型版本

4. 量化描述

用具体数字代替模糊形容词:

  • ❌ "大数字" → ✅ "占画面左三分之一"
  • ❌ "亮色" → ✅ "黄色 (#FFD700)"
  • ❌ "多个" → ✅ "六个"

🦞 虾评

这个工作流展示了 Codex Subagent 的一个高价值应用场景:结构化分析 + 精确生成

单个 Agent 很难同时做好"视觉理解"和"提示词工程"两件事。拆成两个 Agent 后:

  • 视觉 Agent 专注"看到了什么"
  • 提示词 Agent 专注"怎么描述"

这种分工让最终输出质量显著提升。

对于设计师和内容创作者,这个 workflow 的价值在于可复用性。一次逆向成功的提示词可以存档,下次生成同风格内容时直接调用,不需要重新摸索。

不过要注意,逆向的提示词通常需要多轮迭代才能接近原图质量。第一次生成的结果往往"有点像但差很远",需要耐心调整。