第 4/60 天
引言
当你打开 Midjourney 或 Stable Diffusion,输入一句 “a cat” 得到一张猫图——这很容易。但当你想要一张”从低角度仰视、英雄站在废墟中央、夕阳逆光、镜头带鱼眼畸变、左侧三分构图”的漫画分镜时,简单的描述就远远不够了。
提示词工程(Prompt Engineering) 正是解决这个问题的系统方法论。在 AI 漫画制作流程中,提示词决定了分镜的构图、角色位置、镜头语言和画面氛围。掌握提示词工程,就等于掌握了将脑海中的漫画分镜翻译成 AI 能理解的语言的能力。
本文将系统讲解 AI 漫画分镜的提示词编写方法,从基础语法到高级技巧,配合大量可直接复用的模板。
核心概念
1. 提示词的四大要素
一个完整的漫画分镜提示词包含四个维度:
| 维度 | 说明 | 示例 |
|---|---|---|
| 主体 (Subject) | 角色/物体及其动作 | a warrior with a broken sword, standing on rubble |
| 环境 (Environment) | 场景、背景、氛围 | ruined city, sunset, dust particles in air |
| 镜头 (Camera) | 角度、距离、构图 | low angle shot, wide lens, rule of thirds |
| 风格 (Style) | 画风、渲染、色彩 | comic style, ink wash, cel shading, line art |
2. 权重与语法
在 Stable Diffusion 系模型(包括 NovelAI、Niji 等)中,用 (word:weight) 控制关键词的强调程度:
(epic battle scene:1.3), (dynamic pose:1.2), (detailed armor:1.1)
也可以使用 ((word)) 简写,每层括号约等于 1.1 倍权重:
((epic battle scene)), (dynamic pose:1.2), detailed armor
3. 负面提示词(Negative Prompt)
负面提示词排除不想要的元素,是漫画分镜质量的关键:
bad anatomy, extra fingers, deformed hands, blurry, low quality,
worst quality, jpeg artifacts, watermark, text, signature
实战步骤
步骤 1:构建基础提示词模板
下面是一个通用的漫画分镜提示词模板,可直接作为起点:
# 通用漫画分镜提示词模板
# 替换 {占位符} 即可
{male/female character description}, {action/pose},
wearing {costume details},
in {environment/scene},
{lighting/atmosphere},
{camera angle} shot, {framing/composition},
{art style}, {color palette},
--ar {aspect ratio} --v {model version}
步骤 2:镜头角度控制示例
不同的镜头角度传达不同的情绪:
低角度仰拍(Low Angle Shot) — 突出角色威严/压迫感:
low angle shot from ground level, looking up at a towering mecha,
silhouette against blazing sun, dramatic clouds,
heroic pose, chest thrust forward, cape billowing,
wide angle lens, heavy perspective distortion,
comic book style, bold inks, flat colors
--ar 16:9 --v 6
俯拍(High Angle / Bird’s Eye View) — 展示全貌或角色脆弱感:
bird's eye view, looking down at a lone figure standing in a
circular arena, surrounded by shadowy enemies,
dramatic lighting, spotlight effect, dust motes,
cinematic composition, top-down perspective,
manga style, screentone shading, high contrast
--ar 3:4 --v 6
过肩镜头(Over-the-Shoulder) — 对话场景的标准分镜:
over the shoulder shot, focused on a detective sitting at a desk,
foreground blurred shoulder of another character,
moody office, venetian blinds casting shadow stripes,
neon sign glow through window, film noir atmosphere,
graphic novel style, dark tones, red accents
--ar 16:9 --v 6
步骤 3:角色位置与构图控制
使用 python 脚本批量生成多角度分镜提示词:
#!/usr/bin/env python3
"""批量生成漫画分镜提示词"""
scenes = [
{
"character": "a young mage with glowing blue eyes, holding a staff",
"action": "casting a spell, energy swirling around hands",
"environment": "ancient library, floating books, magical runes on walls",
"camera": "medium shot, slight low angle",
"lighting": "bioluminescent blue light from the spell, candlelight",
"style": "anime style, cel shading, vibrant colors, detailed background",
"ar": "16:9"
},
{
"character": "a samurai warrior, scarred face, determined expression",
"action": "drawing katana slowly, preparing for battle",
"environment": "bamboo forest at dawn, mist on the ground",
"camera": "extreme close up on eyes, shallow depth of field",
"lighting": "golden hour sunlight filtering through bamboo",
"style": "ink wash painting style, watercolor, minimalist",
"ar": "3:4"
}
]
for i, s in enumerate(scenes, 1):
prompt = (
f"{s['character']}, {s['action']}, "
f"in {s['environment']}, "
f"{s['lighting']}, "
f"{s['camera']}, "
f"{s['style']} "
f"--ar {s['ar']} --v 6"
)
print(f"=== Scene {i} ===")
print(prompt)
print()
步骤 4:JSON 配置文件管理分镜
将分镜参数存入 JSON,方便版本控制和批量处理:
{
"project": "AI漫剧制·短篇漫画",
"chapter": 1,
"panels": [
{
"id": "panel-01",
"type": "establishing",
"prompt": "wide panoramic shot of a floating city in the sky, waterfalls falling from the edges, airships docked at spires, golden sunset, clouds below, studio ghibli style, dreamy atmosphere, highly detailed --ar 16:9 --v 6",
"negative_prompt": "modern buildings, cars, people, text, watermark, blurry, low quality",
"notes": "开场全景建立世界观"
},
{
"id": "panel-02",
"type": "medium",
"prompt": "a young girl with goggles on her forehead, leaning over a railing, looking down at the city below, wind blowing her hair, side profile, warm lighting, soft shadows, anime style, bokeh background --ar 16:9 --v 6",
"negative_prompt": "bad anatomy, extra fingers, deformed face, text",
"notes": "主角登场,侧面视角"
}
]
}
步骤 5:Shell 脚本批量生成分镜
用 bash 脚本配合 curl 调用 Stable Diffusion API 批量生成:
#!/bin/bash
# batch-generate-panels.sh — 批量生成漫画分镜
PANELS_JSON="panels.json"
OUTPUT_DIR="./output_panels"
API_URL="http://localhost:7860/sdapi/v1/txt2img"
mkdir -p "$OUTPUT_DIR"
# 解析 JSON 中的 panel 数量
TOTAL=$(python3 -c "import json; d=json.load(open('$PANELS_JSON')); print(len(d['panels']))")
for i in $(seq 0 $((TOTAL - 1))); do
PANEL_ID=$(python3 -c "import json; d=json.load(open('$PANELS_JSON')); print(d['panels'][$i]['id'])")
PROMPT=$(python3 -c "import json; d=json.load(open('$PANELS_JSON')); print(d['panels'][$i]['prompt'])")
NEGATIVE=$(python3 -c "import json; d=json.load(open('$PANELS_JSON')); print(d['panels'][$i].get('negative_prompt',''))")
echo "Generating panel [$PANEL_ID]..."
python3 -c "
import requests, json
data = {
'prompt': '''$PROMPT''',
'negative_prompt': '''$NEGATIVE''',
'steps': 30,
'cfg_scale': 7,
'width': 896,
'height': 512,
'sampler_name': 'Euler a'
}
resp = requests.post('$API_URL', json=data)
result = resp.json()
for idx, img_b64 in enumerate(result['images']):
with open('$OUTPUT_DIR/${PANEL_ID}_' + str(idx) + '.png', 'wb') as f:
import base64
f.write(base64.b64decode(img_b64))
print('Done: $PANEL_ID')
"
done
echo "All panels generated in $OUTPUT_DIR"
常见问题
Q1: 为什么我写的提示词生成的画面和想象完全不一样?
原因: 提示词缺少关键约束,AI 的自由度太高。漫画分镜需要同时控制主体、环境、镜头和风格四个维度。建议使用步骤 1 中的模板逐项填写,不要遗漏任何维度。
Q2: 如何让 AI 保持角色一致性?
方案: 使用角色描述卡(Character Sheet)。将角色的外貌特征固定为一段标准描述,在每张分镜中重复使用:
Character: "Alice, a 16-year-old girl, short blue hair, green eyes,
wearing a white lab coat over a red hoodie, goggles on forehead,
freckles on cheeks, slim build"
建议将角色描述放在提示词最前面,然后用 --seed 固定随机种子,微调画面时保持 seed 不变。
Q3: 长提示词效果更好吗?
不一定。 提示词并非越长越好。关键信息密度比长度更重要。建议控制提示词在 80-150 个英文单词之间,超过 200 个词时 AI 会丢失早期信息。优先保证:主体描述 > 镜头角度 > 环境氛围 > 风格。
Q4: 负面提示词应该写什么?
通用负面提示词:
bad anatomy, bad hands, extra fingers, fewer fingers,
crooked fingers, deformed hands, missing fingers,
mutated hands, extra limbs, missing limbs,
bad proportions, distorted face, ugly,
low quality, worst quality, blurry, jpeg artifacts,
nsfw, watermark, text, signature, username
Q5: 不同模型(Midjourney vs SD vs Niji)的提示词写法有区别吗?
有区别:
| 模型 | 特点 | 提示词策略 |
|---|---|---|
| Midjourney | 自然语言友好,风格一致 | 用完整句子描述,--ar 控制比例,--s 控制风格化 |
| Stable Diffusion | 需要精确关键词,权重语法 | 用逗号分隔关键词,(word:weight) 控制权重 |
| Niji Journey | 动漫风格专用,色彩鲜艳 | 类似 MJ 但更短,--niji 5 参数,适合二次元 |
总结
提示词工程是 AI 漫画分镜的基石。通过系统化地控制主体、环境、镜头、风格四个维度,你可以将脑海中的画面精确地传达给 AI 模型。关键要点:
- 结构化提示词:使用模板确保覆盖所有关键维度
- 镜头语言控制:低角度/俯拍/过肩/特写各有不同的情绪表达
- 权重语法:用
(word:weight)精确控制 AI 的关注重点 - 负面提示词:排除不想要的元素,提升画面质量
- 批量生产能力:结合 JSON 配置文件 + Shell/Python 脚本实现工业化生产
下一篇文章将介绍如何利用 ComfyUI 搭建可视化的漫画分镜工作流,将今天学的提示词工程落地到实际工具中。















暂无评论内容