AI 图像生成提示词动态组装指南
1. 概述
本指南旨在帮助开发者理解并实现 AI 图像生成提示词的动态组装。用户在前端选择"风格"、"场景",以及是否调整"背景"和"原始人物形象"。根据这些选择,程序将构建一个完整的英文提示词,用于图生图模型。
核心原则:
- 模块化: 提示词被分解为可重用的片段。
- 动态组装: 根据用户选择,将相应的片段插入到通用模板中。
- 精确性: 确保只有新生成的人物被风格化(如像素化),原始人物和背景保持其原有风格(或根据选择进行非像素化调整)。
2. 提示词组成部分
我们将提示词分为以下几类片段:
2.1 通用提示词模板(General Prompt Template)
这是所有提示词的基础骨架,其中包含需要被替换的占位符。
Generate a new image based on the provided input picture.
Core Requirements:
1. [ORIGINAL_CHARACTER_MODIFICATION_INSTRUCTION]
2. **New Generated Character:** Next to the original person, create a brand new, independent, stylized character.
* **Style:** [SELECTED_STYLE_PROMPT]
* **Features:** The face and pose should be highly similar to the original person.
* **Context:** [SELECTED_SCENE_CHARACTER_PROMPT]
* **Composition:** The new character should be precisely placed in an appropriate area next to the original person, ensuring a clear gap between them, no overlap, and no covering of original elements. The new character's size, rotation, and perspective should be consistent with the original person and the background for natural integration.
* **Blending:** The lighting, colors, and atmosphere of the new character should naturally and harmoniously blend with the image's environmental lighting and color scheme, with smooth transitions at the edges.
3. [BACKGROUND_MODIFICATION_INSTRUCTION]
**Final Result:** A high-quality image clearly and naturally presenting the original person (modified or unmodified as per user choice), alongside the newly generated, stylized character, both coexisting within the background (modified or unmodified as per user choice), forming a visually harmonious and logically coherent composition.2.2 条件指令片段(Conditional Instruction Snippets)
这些片段根据用户对"原始人物调整"和"背景调整"的选择来确定。
2.2.1 原始人物调整指令(ORIGINAL_CHARACTER_MODIFICATION_INSTRUCTION)
如果用户选择"不调整原始人物形象":
The original person from the input image, including their face, pose, clothing, props, lighting, and exact position, must remain absolutely unchanged, without any modification, re-rendering, stylistic alteration, or pixelation.如果用户选择"针对场景调整原始人物形象":
The original person from the input image should be subtly adjusted to fit the scene. Their face, pose, and general appearance should be maintained, but their clothing, props, and overall atmosphere should be adapted to: [SELECTED_SCENE_CHARACTER_PROMPT]. The lighting and position should remain consistent with the original image.2.2.2 背景调整指令(BACKGROUND_MODIFICATION_INSTRUCTION)
如果用户选择"背景严格保持原图不变":
The background of the original image must remain strictly unchanged, without any modification or re-rendering.如果用户选择"背景针对场景进行调整":
The background area of the original image (excluding the original person and new character) should undergo stylistic transformation. Retain the original background's composition, depth, and main structural elements. The background must NOT be pixelated. Stylize it into: [SELECTED_SCENE_BACKGROUND_PROMPT]. Ensure the stylized background naturally connects with the original person's perspective and lighting, maintaining a reasonable sense of space and horizon.2.3 风格提示词片段(SELECTED_STYLE_PROMPT)
这些片段定义了新生成人物的艺术风格。
像素风(Pixel Art Style):
Pixel art style only, 8-bit/16-bit retro game graphics, low resolution, blocky pixels, sharp outlines, simplified details, cartoonish character.3D 风(3D Style):
High-quality 3D game render style, highly three-dimensional and deep, finely detailed model, clear edges, rich material details, realistic and dramatic lighting effects, bright and vibrant character colors.粘土风(Claymation Style):
Claymation style, handmade clay texture, visible fingerprint textures and kneading marks on the object surface, matte frosted colors, soft rounded edges, overall childlike handcrafted art atmosphere, soft and natural light reflection.2.4 场景人物提示词片段(SELECTED_SCENE_CHARACTER_PROMPT)
这些片段描述了新生成人物在特定场景下的特征。
场景 - 冰雪玩家(Scene - Snow Player):
A vibrant snow sports player, wearing a stylish ski suit, matching protective gear, with their face visible, holding a modern snowboard.场景 - 双旦 dating(Scene - Holiday Dating):
Wearing warm and fashionable Christmas or New Year festive attire, holding festive small items, with sweet and happy expressions, creating a romantic and cozy holiday atmosphere.场景 - 质感通勤(Scene - Chic Commuter):
Wearing an exquisite and textured winter commuter outfit, paired with sleek professional accessories, with a steady and confident posture, showcasing the elegance and strength of an urban professional.场景 - 冬季运动(Scene - Winter Sports):
A focused winter sports athlete, skilled in various winter sports, choosing one, wearing professional high-performance sports gear corresponding to the chosen sport, exuding the passion and power of sports. Radiating the charm of competitive sports.场景 - 冬日多巴胺(Scene - Winter Dopamine):
Wearing vibrant, high-saturation "Dopamine" winter fashion, creating a joyful dressing style, with cheerful and lively expressions, breaking the winter dullness with an explosion of color.场景 - CNY 中国春节(Scene - Chinese New Year):
Wearing modernly designed Lunar New Year clothing fused with traditional elements, attire primarily in auspicious red and gold tones, featuring traditional patterns (e.g., auspicious clouds, dragons, plum blossoms), holding a red envelope or Spring Festival fan, with festive expressions, clothing adorned with festive tassels, full of reunion and good fortune atmosphere.2.5 场景背景提示词片段(SELECTED_SCENE_BACKGROUND_PROMPT)
这些片段描述了特定场景下的背景。
场景 - 冰雪玩家(Scene - Snow Player):
A Hokkaido-style snowy mountain landscape or ski resort, covered with unique fluffy powder snow, accompanied by a clear blue sky and dense snow pine forests. Distant Japanese wooden houses or hot springs can be subtly visible, creating a serene and pure Japanese winter atmosphere.场景 - 双旦 dating(Scene - Holiday Dating):
A festive background with holiday elements. If indoors, add bokeh light spots from string lights, a decorated Christmas tree in the corner, candles on a table. If outdoors, add twinkling festive lights on buildings, falling snowflakes in the sky, and warm light emanating from shop windows.场景 - 质感通勤(Scene - Chic Commuter):
A clean and modern urban background, possibly high-rise buildings or a busy street scene, with calm colors and smooth lines, showcasing the city's coolness and efficiency.场景 - 冬季运动(Scene - Winter Sports):
A dynamic winter sports venue, possibly a smooth ice rink or a snowfield cut by ski slopes, with a slightly blurred sense of speed in the background, showcasing the focus and passion of competition.场景 - 冬日多巴胺(Scene - Winter Dopamine):
A vibrant and playful abstract background, integrating bright color blocks, geometric shapes, or ink splash effects, creating a fashionable, individual, and artistic space.场景 - CNY 中国春节(Scene - Chinese New Year):
A festive and auspicious Chinese New Year background, featuring traditional architecture, red lanterns, window decorations, bustling street scenes, or distant blooming fireworks, full of oriental charm and holiday atmosphere.3. 提示词组装逻辑
开发者应按照以下步骤组装最终的提示词:
第一步:获取通用模板
从"2.1 通用提示词模板"中获取基础模板字符串。
第二步:处理风格选择
根据用户选择的风格(例如"像素风"),从"2.3 风格提示词片段"中找到对应的描述,并替换模板中的 [SELECTED_STYLE_PROMPT] 占位符。
第三步:处理场景人物描述
根据用户选择的场景(例如"冰雪玩家"),从"2.4 场景人物提示词片段"中找到对应的描述,并替换模板中的 [SELECTED_SCENE_CHARACTER_PROMPT] 占位符。
第四步:处理原始人物调整指令
根据用户对"是否针对场景调整原始人物形象"的选择:
- 如果用户选择"否"(即严格保持原图不变): 从"2.2.1 原始人物调整指令"中选择"不调整原始人物形象"对应的片段,替换模板中的
[ORIGINAL_CHARACTER_MODIFICATION_INSTRUCTION]占位符。 - 如果用户选择"是"(即针对场景调整): 从"2.2.1 原始人物调整指令"中选择"针对场景调整原始人物形象"对应的片段。注意:这个片段内部包含
[SELECTED_SCENE_CHARACTER_PROMPT]占位符,需要用第三步中已获取的场景人物描述再次替换。然后,将处理好的片段替换模板中的[ORIGINAL_CHARACTER_MODIFICATION_INSTRUCTION]占位符。
第五步:处理背景调整指令
根据用户对"是否需要针对场景调整背景"的选择:
- 如果用户选择"否"(即严格保持原图不变): 从"2.2.2 背景调整指令"中选择"背景严格保持原图不变"对应的片段,替换模板中的
[BACKGROUND_MODIFICATION_INSTRUCTION]占位符。 - 如果用户选择"是"(即针对场景调整): 从"2.2.2 背景调整指令"中选择"背景针对场景进行调整"对应的片段。注意:这个片段内部包含
[SELECTED_SCENE_BACKGROUND_PROMPT]占位符,需要用"2.5 场景背景提示词片段"中对应场景的背景描述进行替换。然后,将处理好的片段替换模板中的[BACKGROUND_MODIFICATION_INSTRUCTION]占位符。
第六步:最终组装
将所有替换完成的片段组合起来,形成最终的完整英文提示词。接口参数的具体定义可参考 03. 图像生成接口参数。
4. 完整示例 - 冰雪玩家场景
假设用户在前端进行了以下选择:
- 风格: 像素风
- 场景: 冰雪玩家
- 是否需要针对场景调整背景: 是
- 是否针对场景调整原始人物形象: 否(即原始人物严格保持原图不变)
以下是组装过程及最终提示词:
第一步:获取通用模板
(如"2.1 通用提示词模板"所示)
第二步:处理风格选择
用户选择"像素风",获取片段:
Pixel art style only, 8-bit/16-bit retro game graphics, low resolution, blocky pixels, sharp outlines, simplified details, cartoonish character.
替换模板中的 [SELECTED_STYLE_PROMPT]。
第三步:处理场景人物描述
用户选择"冰雪玩家",获取片段:
A vibrant snow sports player, wearing a stylish ski suit, matching protective gear, with their face visible, holding a modern snowboard.
替换模板中的 [SELECTED_SCENE_CHARACTER_PROMPT]。
第四步:处理原始人物调整指令
用户选择"原始人物严格保持原图不变",获取片段:
The original person from the input image, including their face, pose, clothing, props, lighting, and exact position, must remain absolutely unchanged, without any modification, re-rendering, stylistic alteration, or pixelation.
替换模板中的 [ORIGINAL_CHARACTER_MODIFICATION_INSTRUCTION]。
第五步:处理背景调整指令
用户选择"针对场景调整背景",获取"背景针对场景进行调整"的片段:
The background area of the original image (excluding the original person and new character) should undergo stylistic transformation. Retain the original background's composition, depth, and main structural elements. The background must NOT be pixelated. Stylize it into: [SELECTED_SCENE_BACKGROUND_PROMPT]. Ensure the stylized background naturally connects with the original person's perspective and lighting, maintaining a reasonable sense of space and horizon.
然后,获取"冰雪玩家"场景的背景描述片段:
A Hokkaido-style snowy mountain landscape or ski resort, covered with unique fluffy powder snow, accompanied by a clear blue sky and dense snow pine forests. Distant Japanese wooden houses or hot springs can be subtly visible, creating a serene and pure Japanese winter atmosphere.
将此背景描述片段替换上述指令片段中的 [SELECTED_SCENE_BACKGROUND_PROMPT]。最终的背景指令片段为:
The background area of the original image (excluding the original person and new character) should undergo stylistic transformation. Retain the original background's composition, depth, and main structural elements. The background must NOT be pixelated. Stylize it into: A Hokkaido-style snowy mountain landscape or ski resort, covered with unique fluffy powder snow, accompanied by a clear blue sky and dense snow pine forests. Distant Japanese wooden houses or hot springs can be subtly visible, creating a serene and pure Japanese winter atmosphere. Ensure the stylized background naturally connects with the original person's perspective and lighting, maintaining a reasonable sense of space and horizon.
替换模板中的 [BACKGROUND_MODIFICATION_INSTRUCTION]。
第六步:最终组装后的提示词
Generate a new image based on the provided input picture.
Core Requirements:
1. The original person from the input image, including their face, pose, clothing, props, lighting, and exact position, must remain absolutely unchanged, without any modification, re-rendering, stylistic alteration, or pixelation.
2. **New Generated Character:** Next to the original person, create a brand new, independent, stylized character.
* **Style:** Pixel art style only, 8-bit/16-bit retro game graphics, low resolution, blocky pixels, sharp outlines, simplified details, cartoonish character.
* **Features:** The face and pose should be highly similar to the original person.
* **Context:** A vibrant snow sports player, wearing a stylish ski suit, matching protective gear, with their face visible, holding a modern snowboard.
* **Composition:** The new character should be precisely placed in an appropriate area next to the original person, ensuring a clear gap between them, no overlap, and no covering of original elements. The new character's size, rotation, and perspective should be consistent with the original person and the background for natural integration.
* **Blending:** The lighting, colors, and atmosphere of the new character should naturally and harmoniously blend with the image's environmental lighting and color scheme, with smooth transitions at the edges.
3. **Background Processing:** The background area of the original image (excluding the original person and new character) should undergo stylistic transformation. Retain the original background's composition, depth, and main structural elements. The background must NOT be pixelated. Stylize it into: A Hokkaido-style snowy mountain landscape or ski resort, covered with unique fluffy powder snow, accompanied by a clear blue sky and dense snow pine forests. Distant Japanese wooden houses or hot springs can be subtly visible, creating a serene and pure Japanese winter atmosphere. Ensure the stylized background naturally connects with the original person's perspective and lighting, maintaining a reasonable sense of space and horizon.
**Final Result:** A high-quality image clearly and naturally presenting the unmodified original person, alongside the newly generated, pixel art style character, both coexisting within the non-pixelated, stylistically transformed, yet structurally preserved, Hokkaido snowy background, forming a visually harmonious and logically coherent composition.相关文章
- 02. RedNote图片生成全链路 — 提示词在实际流水线中的完整调用链路
- 03. 图像生成接口参数 — 风格/场景枚举值与请求参数说明
- 04. 小红书AI生图提示词 — 六大场景的完整提示词方案
- 02. JSON Schema结构化输出 — 结构化输出的方法论基础