博客

使用指南

面向开发者的 Ideogram v4.5 图生图提示词配方

可直接复制的编辑提示词:主体保真、背景替换与文字保留

2026年11月10日
抽象扁平液态色块交叠的封面图,墨黑底色上点缀青瓷绿与石板灰的层叠流动形态。
本页内容

为什么图生图提示词需要不同的结构

文生图提示词描述的是一个场景。图生图提示词则要与一张已经存在的图像协商。这种差异是结构性的,而非表面修饰,也正是那些从零开始效果很好的提示词,一旦喂给参考图就产出浑浊结果的主要原因。

当你描述一个场景时,每个 token 都是叠加的:你是在填充一张空白画布。而当你编辑一张图像时,每个 token 要么是保留指令,要么是变更指令,模型必须判断哪个是哪个。一个只写「咖啡馆里穿红色夹克的女子」的提示词,会让模型可以自由地重绘面部、重新设计夹克剪裁、重新构想整个房间。它没有任何理由保留任何东西,因为你从未要求它保留。

解决办法是把编辑写成双通道指令:一条通道说明编辑后必须存活下来的内容,另一条说明应当改变的内容。本指南后续的所有内容都基于这一划分。保留通道不是装饰——它是阻止模型重掷你已经认可过的细节的契约。

在写任何编辑提示词之前,做一个快速的心智测试:读一遍你的草稿,问自己「如果模型改变了这一点,输出会是错的吗?」如果答案是肯定的,这个细节就属于保留通道。如果它属于保留通道,但你只是在描述性句子里顺带提了一句,那就把它移到前面,并用指令的语气表述。

由此可得出两个推论。第一,编辑提示词通常比生成提示词更短,因为你不再重新描述参考图已经展示的内容——你描述的是差异。第二,它们更字面化:祈使句式(「keep」「do not change」「replace only」)比形容词更可靠。下面的配方都建立在这两个习惯之上。

一条提示词,两条通道:编辑保留什么,又改变什么。

基础配方:编辑指令的解剖结构

本指南中的每个配方都是同一个骨架的变体。学会这个骨架,你就能凭记忆重建任何配方。

五个槽位

  1. 编辑意图——一句话说明操作及其范围(「只改变这张产品照片的背景。」)。
  2. 保留条款——明确列出不得改变的内容(身份、几何、文字、颜色、裁切)。
  3. 变更条款——要修改什么,描述得足够具体、可执行。
  4. 风格/融合条款——新元素必须如何与旧元素融合(光照方向、阴影柔和度、透视、颗粒)。
  5. 约束——硬性限制与排除项(不新增物体、不改文字、不重新取景)。

一个填空式模板

Edit intent: <operation> on <target region>.
Preserve: <subject identity>, <geometry/pose>, <text and layout>, <color and material>.
Change: <what to replace or add>, <how much of the frame it covers>.
Integrate: match <light direction>, <shadow behavior>, <perspective>, <film grain / noise>.
Constraints: do not <failure mode 1>; do not <failure mode 2>; keep <critical edge> clean.

顺序比你预想的更重要。把保留条款放在变更条款之前,可以在模型开始绘制新区域之前先锚定主体,实践中这能显著减少身份漂移。把融合条款放在变更条款之后,则能让融合指令与被融合的对象保持绑定。

保持编辑意图狭窄

一条提示词,一个操作。「换掉背景,同时更新标题字体」是两次编辑,模型往往会以牺牲较简单的那个为代价去完成较难的那个。改为分两遍执行,把第一遍的输出喂给第二遍。本指南后面的排版与文字配方就依赖这种链式模式。

让槽位可复用

团队获得可复现性的方式是冻结那些很少变化的槽位措辞——保留条款与约束——每个任务只编辑变更条款和融合条款。把这些冻结的字符串写下来一次,放进共享常量中,你的提示词就不会在不同作者之间漂移。本指南后续内容会为每个槽位族给出起始值。

基础配方如同一串流体块:每个槽位折叠进下一个,从保留条款到约束。

主体保真度配方

主体保真度是大多数人描述不足的槽位。「保留主体」太模糊,绑定不了任何东西;模型会把它理解为「保留某种像主体的东西」。请点名你在意的属性。

配方:保脸换语境

Edit intent: change the setting around the person in this photo; the person is not the edit target.
Preserve: the person's facial identity, facial proportions, skin tone, hairline and hairstyle, expression, pose, and body proportions.
Change: the environment behind and around the person to <new scene>.
Integrate: relight the person's edges to match the new scene's <light direction> and <color temperature>; keep shadow softness consistent with the new environment.
Constraints: do not smooth, beautify, or re-synthesize the face; do not change the head angle; do not alter clothing cut or color.

do not smooth or beautify 这一行有其价值。照片模型默认倾向于美颜修饰,没有这条约束,背景替换会悄悄返回一个看起来不一样的人。

配方:产品与包装一致性

Edit intent: place the product from this image into a new scene.
Preserve: product silhouette, proportions, label placement, typography on the label, cap and seam geometry, material finish, and brand colors.
Change: the surface it rests on and the surrounding scene to <new setting>.
Integrate: match perspective and horizon; add a contact shadow and a plausible reflection on <surface>; match overall exposure to the new scene.
Constraints: do not redraw the label; do not add or remove product features; do not change the camera angle.

对于包装而言,标签就是身份。如果它变形了,即使渲染图看起来不错,这次编辑在商业上也是失败的。

配方:角色与插画连续性

Edit intent: keep the character exactly as drawn and change only their surroundings.
Preserve: character proportions, line weight, facial design, marking and pattern placement, outfit design, and palette.
Change: the background and props around the character to <new context>.
Integrate: keep the illustration style, stroke consistency, and shading language identical to the reference.
Constraints: do not add costume details; do not change the art style; do not alter character scale relative to the frame.

保真度仍然漂移时怎么办

如果两次尝试后身份仍然漂移,别再改写变更条款——问题通常是范围。把参考图在主体周围裁得更紧,让它占据更大画幅;或者减小你要求模型替换的区域大小。保真度问题常常只是披着提示词外衣的取景问题。

同样的核心,两种不同的液体语境:固定的主体保持相同,而周围形态发生变化。

背景替换配方

背景替换会以两种典型方式失败:主体边缘出现光晕或毛边,以及新场景的光照与主体原始光照不一致。两者都靠融合条款解决,而不是靠更详细地描述新背景。

配方:干净边缘的影棚替换

Edit intent: replace the background only; the subject remains untouched.
Preserve: the subject's outline down to fine edges — hair strands, fur, fabric edges, transparent or reflective parts.
Change: the background to <seamless backdrop / gradient / studio sweep>.
Integrate: light the backdrop independently of the subject; keep the subject's existing key light direction; do not add a colored spill onto the subject.
Constraints: no fringe or halo at the subject edge; no background color bleeding into hair or translucent materials; do not crop or rescale the subject.

明确点出毛边是这里价值最高的一行。没有它,哑光式光晕在头发和半透明包装上是很常见的默认结果。

配方:光照匹配的环境替换

Edit intent: replace the location around the subject.
Preserve: subject identity, pose, scale, and position in frame; existing shadow shape on the subject is the reference for light direction.
Change: the environment to <new location>, including depth cues appropriate to that location.
Integrate: derive the new light direction and color temperature from the subject's existing highlights; add environment contact shadows under the subject; match depth of field and grain to the reference.
Constraints: no duplicated light sources; do not introduce reflections that contradict the new scene; do not change the subject's cast shadow direction relative to the new light.

告诉模型从现有高光中推导光照,比用文字描述光照更可靠。参考图已经编码了真相;你的提示词只需指向它。

配方:局部背景编辑

Edit intent: modify only the region behind the subject below the shoulder line.
Preserve: everything above that line, including the subject and the existing upper background.
Change: the lower background to <new content>.
Integrate: continue the perspective and color grade of the untouched upper region seamlessly across the boundary.
Constraints: no visible seam; no change to subject edges; do not shift the subject.

区域限定编辑能让你避免重掷已经满意的背景。用直白的空间语言描述边界——模型对它的理解比百分比坐标更一致。

保留排版与文字的配方

排版是单条通用提示词泄漏最严重的地方。文字是最先融化、也是直到客户看到之前你最后才注意到的部分。把文字当作锁定图层,并明确说出来。

配方:锁定排版的海报

Edit intent: change the imagery in this poster; the text layer is locked.
Preserve: every character of existing text, including exact spelling, capitalization, punctuation, font style, weight, size, line breaks, alignment, and position in the layout.
Change: the photographic or illustrative elements <describe region>.
Integrate: keep the same margins and grid; ensure the new imagery does not sit behind or overlap any text.
Constraints: do not re-render, re-typeset, or paraphrase any text; do not add new copy; do not change contrast between text and its immediate background.

do not paraphrase 这条约束很重要:模型有时会在保留文字外形的同时「纠正」文案,这比明显的损坏更糟,因为快速一瞥很难发现。

配方:截图与 UI 资产编辑

Edit intent: update visual styling of this interface asset without changing its content.
Preserve: all labels, numbers, icons' meaning, component positions, spacing, and reading order.
Change: <color theme / border radius / shadow depth> only.
Integrate: apply the change consistently across all matching components.
Constraints: do not add, remove, or reorder UI elements; do not alter any glyph; keep text legible at the original size.

配方:带 logo 的品牌资产

Edit intent: place this branded asset into a new context.
Preserve: logo geometry, letterforms, clear space around the mark, and brand colors exactly.
Change: the surrounding composition to <new layout or scene>.
Integrate: match the new composition's perspective while keeping the logo flat and undistorted.
Constraints: do not redraw, restyle, or outline the logo; do not place the logo on a busy area that reduces contrast; do not crop the clear space.

关于链式执行的实用说明

如果图像和文字都必须改变,分两遍执行:先锁定文字、编辑图像,然后单独编辑文字图层并锁定图像。多操作提示词会互相打架;分步执行则不会。在第二遍中完整保留第一遍的保留条款,这样文字编辑就不会撤销图像工作。

构建负面清单

图生图中的负面指令不是第二条提示词——它们是一份回归清单。保持简短,保持具体到你实际见过的失败模式,并把它附加到模板的约束槽位,而不是事后追加。

反复出现的失败模式

  • 身份漂移——面部或产品被微妙地重新合成。负面:do not alter facial features; do not smooth or beautify skin; do not redraw the product label。
  • 边缘伪影——头发或半透明材质上出现光晕、毛边、锯齿状遮罩。负面:no halo or fringe at subject edges; no background bleed into hair。
  • 光照不匹配——新场景与主体高光或阴影不一致。负面:no conflicting light directions; no duplicated shadows; no colored spill on the subject。
  • 文字损坏——文案融化、拼错或被悄悄改写。负面:do not re-typeset or paraphrase any text; do not add copy。
  • 排版蔓延——元素移动、边距改变、组件重排。负面:do not move, resize, or reorder existing elements。
  • 范围泄漏——模型编辑了你没有要求编辑的区域。负面:change only <region>; leave the rest of the frame untouched。
  • 风格替换——照片变成插画,或扁平插画获得写实阴影。负面:do not change the medium or rendering style。

让清单保持纪律

每条提示词三到六条负面项是实用范围。过长的负面清单会稀释注意力,还可能压制合理细节,所以要删掉任何你尚未亲自观察到回归的项。把清单存为共享列表,让每个配方引用它需要的子集,并给它做版本管理——当评审中出现新的失败模式时,它只被添加一次,然后到处继承。

还有一个值得养成的习惯:当一次编辑失败时,在重写正向提示词之前,先把失败记录为候选负面项。这样做的团队比每次都从零重写的团队更快收敛到稳定提示词。

在代码中测试与迭代配方

提示词配方只有可执行时才成为资产。一个轻量循环就足够了:保持配方不变,改变一个槽位,生成,比较,收紧。

把配方结构化为数据

将冻结槽位保持为常量,将可变槽位保持为参数。这样「测试」就只是不同的参数,而不是手工拼装的不同字符串。

RECIPE = {
  "intent": "Change only the background of this product photo.",
  "preserve": "product silhouette, label typography, brand colors, camera angle",
  "integrate": "match the new scene's light direction and add a contact shadow",
  "constraints": [
    "do not redraw the label",
    "no fringe at the product edge",
    "do not change the camera angle",
  ],
}

def build_prompt(recipe, change, negatives):
    return (
        f"Edit intent: {recipe['intent']}\n"
        f"Preserve: {recipe['preserve']}.\n"
        f"Change: {change}.\n"
        f"Integrate: {recipe['integrate']}.\n"
        f"Constraints: {'; '.join(recipe['constraints'] + negatives)}."
    )

迭代循环

  1. 冻结参考图以及除被测槽位外的所有槽位。
  2. 只改变一件事——通常是变更条款或单条负面项。
  3. 生成变体时走同一次图生图调用,这样唯一的差异就是提示词文本。
  4. 对照保留条款逐项比较:身份、几何、文字、光照。按项打分通过/失败,而不是「看起来不错」。
  5. 修订措辞,然后重跑。只有在某个措辞连续两次通过后,才把它提升为共享配方。

需要记录什么

存储完整提示词、配方版本、参考图标识符,以及每个保留项的通过/失败结果。当有人问某条配方为什么措辞奇怪时,那份日志就是答案——而当模型或端点行为变化时,你可以与上一次已知良好的运行做差异对比,而不是猜测。

交付配方,而不是提示词

一条提示词是一次性的;一个有命名槽位和负面清单的配方是团队资产。给它做版本管理,像审查代码一样审查它的变更,并保留变更历史。这正是图生图编辑能够跨人员、跨时间复现的原因。

当你准备把这些配方接入真实流水线时,HiAPI.ai 上的图生图端点接受相同的提示词结构,并按你的用量计费,当前费率见定价面板。

立即开始构建持久 AI 产物

获取 API 密钥,通过一个基于任务(task)的 API 调用图像、视频和音频模型。

阅读 API 文档