生成AI(Gemini等)に正確に4コマ漫画を生成してもらうためのYAMLの書き方を解説します。
当然ながら唯一無二の正解というわけではないですが、かなり試行錯誤を減らせます。
特にAIが苦手なところにフォーカスを当てました。
目次
基本構造
YAMLの全体構成
# ヘッダー情報
type: multi_panel_manga
title: "作品タイトル"
author: "作者名"
# スタイル設定
style:
color_mode: "fullcolor"
output_style: "anime"
aspect_ratio: "9:16"
# メインプロンプト
main_prompt:
- "以下のYAML指示に従って、4コマ漫画を1枚の画像として生成してください。"
- "添付したキャラクター画像を参考に、キャラクターの外見を一貫させてください。"
# レイアウト指示
layout_instruction:
- "漫画を縦1列に配置してください。"
- "上から下へ1コマずつ縦に並べてください。"
- "セリフは吹き出しで表示してください。"
# コマ数
panel_count: 4
# 各コマの内容
panels:
- panel_number: 1
# (コマの内容)
- panel_number: 2
# ...
# 制約条件
constraints:
# ...
# ハルシネーション防止
anti_hallucination:
# ...
キャラクター配置の書き方
基本原則
AIに正確な配置をさせるには、3つの要素を組み合わせます:
| 要素 | 役割 | 例 |
|---|---|---|
scene |
シーン全体の説明(位置情報を含める) | "ビーチを走る二人。左にキャラ1、右にキャラ2。" |
position |
各キャラの具体的な位置 | "on the left side" |
tags |
人数を厳密に制御 | "duo, 2girls" |
positionの書き方
絶対位置(固定位置)
position: "center" # 中央
position: "on the left side" # 左側
position: "on the right side" # 右側
相対位置(他キャラ基準)
position: "to the immediate right of キャラ1" # キャラ1の右隣
ポイント: 相対位置は「基準となるキャラ名」を含めることで、AIが正確に位置関係を理解できます。
人数別の配置戦略
1人(Solo)
- panel_number: 1
scene: "カフェで一息つくキャラ1。画面中央でリラックスしている。"
tags: "solo, 1girl"
positioning_rule: "solo: Single character at center. Do NOT add extra characters."
characters:
- name: "キャラ1"
position: "center"
reference_image: "キャラ1.png"
dialogue: "ふぅ、一息♪"
features: "リラックスした表情、コーヒーカップを持つ"
重要: soloタグを入れないと、AIが勝手に別のキャラを追加することがあります。
1人を左右に寄せる場合
scene: "キャラ1が画面の【左側】に立っている。右側は背景のみで余白。"
position: "on the left side"
tags: "solo"
注意: 余白(Negative Space)を明示しないと、空いた空間に別キャラを描いてしまいます。
2人(Duo)
ハイブリッド方式(絶対位置 + 相対位置)を推奨:
- panel_number: 1
scene: "ビーチを走る二人。画面左側にキャラ1、その右隣にキャラ2。"
tags: "duo, 2girls"
positioning_rule: "duo: First character on the left, second to the immediate right. Exactly 2 people only."
characters:
- name: "キャラ1"
position: "on the left side" # 絶対位置(アンカー)
reference_image: "キャラ1.png"
dialogue: "夏だ!"
features: "ショートヘア、赤いビキニ"
- name: "キャラ2"
position: "to the immediate right of キャラ1" # 相対位置
reference_image: "キャラ2.png"
dialogue: "海だ〜"
features: "ロングヘア、アニマル柄水着"
なぜ相対位置が効くのか?
- 「Aの隣にB」という関係性をAIに伝える
- 1人目を**アンカー(基準点)**として2人目を配置するため、距離感が安定
3人(Trio)
3点固定方式を推奨:
- panel_number: 1
scene: "3人が横並び。キャラ1とキャラ3の【間に】キャラ2がいる。"
tags: "trio, 3girls"
positioning_rule: "trio: Three-point fixed layout (left/center/right). Exactly 3 people only."
characters:
- name: "キャラ1"
position: "on the left side"
reference_image: "キャラ1.png"
- name: "キャラ2"
position: "center" # ★中央固定
reference_image: "キャラ2.png"
- name: "キャラ3"
position: "on the right side"
reference_image: "キャラ3.png"
なぜ「数珠つなぎ」を使わないか?
# NG例(数珠つなぎ)
- position: "on the left side"
- position: "to the immediate right of キャラ1"
- position: "to the immediate right of キャラ2"
問題:1人目が中央寄りに描かれると、玉突き事故で3人目が画面外にはみ出すリスクがあります。
ナレーションの配置
ナレーション位置の指定
- panel_number: 1
narration: "夏が来た"
narration_rule: "Place narration at TOP of panel. Horizontal text (横書き)."
位置オプション
| 位置 | narration_rule | 備考 |
|---|---|---|
| 上 | Place narration at TOP of panel. Horizontal text (横書き). |
最も一般的 |
| 下 | Place narration at BOTTOM of panel. Horizontal text (横書き). |
次コマへの繋ぎ |
| 右 | Place narration on RIGHT side of panel. VERTICAL text (縦書き, top-to-bottom). |
日本漫画の伝統的配置 |
| 左 | Place narration on LEFT side of panel. VERTICAL text (縦書き, top-to-bottom). |
余韻を残す演出 |
| AIにお任せ | AI chooses the best position for narration. |
自動判断 |
縦書きの例
- panel_number: 2
scene: "夕暮れの浜辺で黄昏る二人。"
narration: "あの夏の思い出は色褪せない"
narration_rule: "Place narration on RIGHT side of panel. VERTICAL text (縦書き, top-to-bottom)."
モブキャラ(群衆)の描き方
パターンA: ぼかす(被写界深度)
雑踏、通行人など、主役を際立たせたい場合:
- panel_number: 1
scene: "繁華街の雑踏を歩く二人。周囲にたくさんの通行人。"
tags: "crowd, many people, depth of field, blurred background, focus on main characters"
positioning_rule: "crowd: Draw background crowd/pedestrians with depth of field. Main characters in focus, crowd blurred."
characters:
- name: "キャラ1"
position: "center"
# ...
重要: duoやtrioタグは入れないでください。入れると無人の街になります。
パターンB: はっきり描く
オーケストラ、チームメイト、教室など背景の人物も重要な場合:
- panel_number: 1
scene: "オーケストラをバックに歌うキャラ1。背後の演奏者たちも真剣な表情。"
tags: "crowd, many people, sharp focus, all in focus, intricate details"
positioning_rule: "crowd: Draw background crowd/people with sharp focus. All characters clearly visible. Main characters in foreground."
characters:
- name: "キャラ1"
position: "center, foreground" # ★「foreground」で主役を際立たせる
# ...
タグ比較表
| シーン | tags | 効果 |
|---|---|---|
| 雑踏(ぼかす) | crowd, many people, depth of field, blurred background |
モブはぼやける |
| オーケストラ(はっきり) | crowd, many people, sharp focus, all in focus, intricate details |
モブもくっきり |
完全なYAMLサンプル
4コマ漫画「夏の日の1枚」
# ====================================================
# Multi Panel Manga (漫画作成)
# ====================================================
type: multi_panel_manga
title: "夏の日の1枚"
author: "作者名"
# ====================================================
# Style
# ====================================================
style:
color_mode: "fullcolor"
output_style: "anime"
aspect_ratio: "9:16"
# ====================================================
# Main Prompt and Layout
# ====================================================
main_prompt:
- "以下のYAML指示に従って、4コマ漫画を1枚の画像として生成してください。"
- "添付したキャラクター画像を参考に、キャラクターの外見を一貫させてください。"
layout_instruction:
- "漫画を縦1列に配置してください。"
- "上から下へ1コマずつ縦に並べてください。"
- "セリフは吹き出しで表示してください。"
- "各コマのpositioning_ruleとnarration_ruleに従ってください。"
# ====================================================
# Panel Count
# ====================================================
panel_count: 4
# ====================================================
# Panels
# ====================================================
panels:
- panel_number: 1
scene: "ビーチを走る二人。画面左側にキャラ1、その右隣にキャラ2。本当に嬉しそう。"
narration: "夏が来た"
narration_rule: "Place narration at TOP of panel. Horizontal text (横書き)."
tags: "duo, 2girls"
positioning_rule: "duo: First character on the left, second to the immediate right. Exactly 2 people only."
characters:
- name: "キャラ1"
position: "on the left side"
reference_image: "キャラ1.png"
dialogue: "夏だ!"
features: "ショートヘア、赤いチェック柄のビキニ、嬉しそうな表情"
- name: "キャラ2"
position: "to the immediate right of キャラ1"
reference_image: "キャラ2.png"
dialogue: "海だ〜"
features: "ロングヘア、アニマル柄水着、楽しそうな表情"
- panel_number: 2
scene: "海の中で水を掛けるキャラ1と、かけられるキャラ2。左にキャラ2、右にキャラ1。"
tags: "duo, 2girls"
positioning_rule: "duo: First character on the left, second to the immediate right. Exactly 2 people only."
characters:
- name: "キャラ2"
position: "on the left side"
reference_image: "キャラ2.png"
dialogue: "いや〜ん"
features: "水をかけられて驚いた表情"
- name: "キャラ1"
position: "to the immediate right of キャラ2"
reference_image: "キャラ1.png"
dialogue: "それそれ〜"
features: "いたずらっぽい笑顔"
- panel_number: 3
scene: "海の家のテーブルで向かい合って座り休憩中。左にキャラ1、右にキャラ2。"
narration: "キャラ2だってノンアルコールなんだよ"
narration_rule: "Place narration at BOTTOM of panel. Horizontal text (横書き)."
tags: "duo, 2girls"
positioning_rule: "duo: First character on the left, second to the immediate right. Exactly 2 people only."
characters:
- name: "キャラ1"
position: "on the left side"
reference_image: "キャラ1.png"
dialogue: "美味しい〜♪"
features: "大盛りかき氷を食べている、幸せそう"
- name: "キャラ2"
position: "to the immediate right of キャラ1"
reference_image: "キャラ2.png"
dialogue: "ホント、子供ね"
features: "トロピカルドリンクを持っている、呆れ顔"
- panel_number: 4
scene: "帰りの電車内、並んで座っている。左にキャラ2、右にキャラ1。"
narration: "楽しかった夏の一日"
narration_rule: "Place narration on RIGHT side of panel. VERTICAL text (縦書き, top-to-bottom)."
tags: "duo, 2girls"
positioning_rule: "duo: First character on the left, second to the immediate right. Exactly 2 people only."
characters:
- name: "キャラ2"
position: "on the left side"
reference_image: "キャラ2.png"
dialogue: "楽しかったね"
features: "清楚なワンピース、満足げな表情"
- name: "キャラ1"
position: "to the immediate right of キャラ2"
reference_image: "キャラ1.png"
dialogue: "また来たいね"
features: "Tシャツと短パン、笑顔"
# ====================================================
# Constraints (CRITICAL)
# ====================================================
constraints:
character_rendering:
- "Preserve exact character appearance from input images"
- "Apply the specified features (expression, pose) to each character"
- "Maintain character identity across all panels"
character_positioning:
- "Follow the 'position' field for each character strictly"
- "Absolute positions: 'on the left side', 'center', 'on the right side'"
- "Relative positions: 'to the immediate right of [name]'"
person_count:
- "The 'tags' field specifies exact person count"
- "'solo' = exactly 1 person, no extras"
- "'duo' = exactly 2 people, no extras"
- "'trio' = exactly 3 people, no extras"
panel_layout:
- "Arrange panels vertically from top to bottom"
- "Each panel should have clear boundaries"
dialogue_rules:
- "Display dialogue in speech bubbles near the speaking character"
# ====================================================
# Anti-Hallucination (MUST FOLLOW)
# ====================================================
anti_hallucination:
- "Do NOT alter character designs from input images"
- "Do NOT add characters not specified in the panel"
- "Do NOT change dialogue text"
- "Do NOT change narration text"
- "Do NOT swap character positions - follow 'position' field exactly"
- "Do NOT ignore 'tags' field - it controls person count"
# ====================================================
# Output Cleanliness (CRITICAL)
# ====================================================
output_cleanliness:
- "Output ONLY the manga panels - nothing else"
- "Do NOT add watermarks, signatures, or logos"
よくある失敗と対策
1. キャラクターの左右が入れ替わる
原因: positionの指定が曖昧
対策:
-
sceneとpositionの両方に位置を明記 - 相対位置(
to the immediate right of [名前])を使う
# Good
scene: "左にキャラ1、右にキャラ2。"
characters:
- name: "キャラ1"
position: "on the left side"
- name: "キャラ2"
position: "to the immediate right of キャラ1"
2. 指定していないキャラが現れる
原因: tagsで人数を制限していない
対策: 必ず人数タグを入れる
# Good
tags: "duo, 2girls" # 2人だけ!
3. モブを入れたら主役しかいなくなった
原因: duo/trioタグとcrowdタグを併用
対策: モブありの時はduo/trioを外す
# Bad
tags: "duo, crowd, many people" # NG: duoが優先されてモブ消える
# Good
tags: "crowd, many people, depth of field" # OK
4. ナレーションが横書きになってしまう
原因: narration_ruleで縦書きを明示していない
対策: 右・左配置の時は必ずVERTICALを指定
narration_rule: "Place narration on RIGHT side of panel. VERTICAL text (縦書き, top-to-bottom)."
まとめ
| 項目 | ポイント |
|---|---|
| 位置指定 |
scene + position の二重指定で精度アップ |
| 人数制御 |
tagsでsolo/duo/trioを必ず指定 |
| 相対位置 | 2人の時は「Aの右隣」方式が有効 |
| 3人固定 | 数珠つなぎより「左/中央/右」の3点固定 |
| モブ |
crowd使用時はduo/trioを外す |
| ナレーション | 右・左は縦書き(VERTICAL)を明示 |
作成日: 2024-12-27