タグ: Google Gemini

ユースケース:Gemini nano banana、トーンの変更。

こちらの続きです。今度は、雰囲気そのものを変えるやり方です。

プロンプトとその生成結果(藤の季節)

利用プロンプト。展開はクリック

Anime / manga style illustration (moe-style, ultra-detailed, glossy finish, cinematic lighting, hyper-detailed texture, high-shine hair strands)
Detail: `huge glossy eyes, small nose, slightly rounded face`
Aspect ratio: 16:9, widescreen

Perspective: Low-angle perspective, viewing character from below, subtle foreshortening to emphasize legs and the foreground objects.
Focus: Upper body, thick thigh emphasis, layered fabrics (pareo/blouse), stationery spread in the immediate foreground, lakeside background (under a wisteria trellis on a wooden deck).

# --------------------
# Variables - Sample Inputs (Integrated & Optimized)
# --------------------
TimeOfDay: late morning (clear sunlight)
Weather: clear blue sky, gentle spring breeze
Season: late spring
Mood: serene, content, scholarly, airy yet elegant, vibrant
Expression: charming smile, lively and happily
GlassesState: Yes (worn)
GlassesStyle: thin rectangular frame
HairBase: black
HairAccent: red blue gradation
HairStyle: pony tail, semi long, strands lifted by gentle breeze
ThighEmphasis: thick, well-rounded upper thighs with prominent volume
HosieryColor: sheer beige 
HosieryPattern: light gray dot pattern, full-leg stocking 
BlouseColor: pearl white
SwimsuitColor: rose red
SwimsuitMotif: lace
RibbonTieColor: elegant pink
PareoColorBase: light purple and cream tartan
ThighStrapColor: leather brown
FootwearColor: low-soled shoes (casual style)
SkinToneDetail: healthy tan face/arms/legs, torso pale
SweatDetail: false (no sweat)
ShoulderExposure: true
NotebookType: thin, stylish laptop (NO ANY IP BRAND, LOGO, TRADEMARK VISIBLE, fancy stickers)
PenType: stylus
StationeryLayout: foldable white low table, a natural jute rug spread 
SideItems: a small glass of iced tea with lemon, a light novel book, wicker basket, smartphone and earphone
ItemPlacement: scattered

# --------------------
# Outfit (Late Spring Lakeside on Deck)
# --------------------
Blouse: sleeveless blouse (color=`BlouseColor`, transparency=`transparent subtle glossy`), vertical seam lines, draped off shoulders (ShoulderExposure=true)
Swimsuit: (color=`SwimsuitColor`) with Motif=`SwimsuitMotif`, barely visible beneath blouse
RibbonTie: ribbon tie (color=`RibbonTieColor`)
Pareo: wrap skirt (color=`PareoColorBase`), style=PareoStyle, subtly sheer, naturally flowing to the ground
Hosiery: full-leg stocking (color=`HosieryColor`) with pattern=`HosieryPattern`, upper section thick and reinforced (OL style)
ThighStrap: single snug thigh strap belt (color=`ThighStrapColor`), emphasizing `ThighEmphasis`
Outerwear: (None)
Accessories: thin rectangular frame glasses (worn), small sapphire accessory, thin golden chain with pocket watch
Footwear: low-soled shoes (color=`FootwearColor`), placed nearby

# --------------------
# Pose / Character (Seated Writing)
# --------------------
BodyOrientation: seated relaxed on a jute rug, full body visible
PoseAction: upper body leaning slightly forward over a thin laptop, actively writing/sketching with a stylus
BodyDetail: Legs slightly bent, one knee raised, casual natural posture, pareo folds flowing naturally to the side/ground, thick thighs prominent in foreground
Expression: charming smile, lively and happily
TearMole: (Optional, tear mole below left eye)

# --------------------
# Scene (Late Spring Wisteria Deck Lakeside)
# --------------------
Location: Wooden deck under a Wisteria trellis (full bloom, soft purple flowers hanging), beside a clear lakeside (calm water, clear reflection). 
Scenery: Clear blue sky visible through the wisteria flowers, gentle breeze, natural jute rug spread on the wooden deck, foldable low table placed on top, wicker basket and a small glass of iced tea visible nearby.  
Atmosphere: Tranquil, studious, lakeside, late spring setting, airy yet elegant (Mood).
EnvironmentalEffects: Clear, bright sunlight filtering through the wisteria trellis, creating dappled light and soft shadows on the deck and the character, subtle fluttering of blouse/pareo/hair with breeze. 

こうして出てきた生成物はこちらです。

今度は、

  • 藤の季節から夏へ変えた場合は変数の変化だけでは足りません。
  • 夏らしい雰囲気を足すプロンプトを明示することが必要です。

この、変数を(つまりキャラクターの髪型や色指定など)をそのままにした状態で、「状況を指示するプロンプト」を追加するとどうなるかがこちらです。

プロンプトとその生成結果(藤が終わった後)

変更後のプロンプトの表示はこちらをクリック
Anime / manga style illustration (moe-style, ultra-detailed, glossy finish, cinematic lighting, hyper-detailed texture, high-shine hair strands)
Detail: `huge glossy eyes, small nose, slightly rounded face`
Aspect ratio: 16:9, widescreen

Perspective: **Low-angle perspective, viewing character from below, subtle foreshortening to emphasize legs and the foreground objects.**
Focus: **Upper body, thick thigh emphasis, layered fabrics (pareo/blouse), stationery spread in the immediate foreground, lakeside background (under a leafy wisteria trellis on a wooden deck).**

# --------------------
# Variables - Sample Inputs (Integrated & Optimized)
# --------------------
TimeOfDay: **midday (strong, bright summer sunlight)**
Weather: **intense summer heat, clear blue sky, slight haze, no breeze**
Season: **mid-summer**
Mood: **sultry, focused, determined, slightly overwhelmed by heat, energetic**
Expression: **charming smile, lively and happily**
GlassesState: **Yes (worn)**
GlassesStyle: **thin rectangular frame**
HairBase: black
HairAccent: red blue gradation
HairStyle: pony tail, semi long, strands *slightly damp and sticking to neck/forehead*
ThighEmphasis: thick, well-rounded upper thighs with prominent volume
HosieryColor: **sheer beige**
HosieryPattern: **light gray dot pattern, full-leg stocking**
BlouseColor: pearl white
SwimsuitColor: rose red
SwimsuitMotif: lace
RibbonTieColor: elegant pink
PareoColorBase: light purple and cream tartan
ThighStrapColor: leather brown
FootwearColor: low-soled shoes (casual style)
SkinToneDetail: **healthy tan face/arms/legs, torso pale, *slightly flushed from heat***
SweatDetail: **true (profuse sweat)**
ShoulderExposure: true
NotebookType: **thin, stylish laptop (NO ANY IP BRAND, LOGO, TRADEMARK VISIBLE, fancy stickers)**
PenType: **stylus**
StationeryLayout: **foldable white low table, a natural jute rug spread**
SideItems: **a small glass of iced tea with condensation (sweating glass), a light novel book, wicker basket, smartphone and earphone, *a handheld folding fan (placed nearby)***
ItemPlacement: **scattered**

# --------------------
# Outfit (Mid-Summer Lakeside on Deck)
# --------------------
Blouse: **sleeveless blouse** (color=`BlouseColor`, transparency=`transparent subtle glossy`, **damp spots visible on back/chest from sweat**), vertical seam lines, **draped off shoulders (ShoulderExposure=true)**
Swimsuit: (color=`SwimsuitColor`) with Motif=`SwimsuitMotif`, barely visible beneath blouse
RibbonTie: ribbon tie (color=`RibbonTieColor`)
Pareo: **wrap skirt** (color=`PareoColorBase`), style=PareoStyle, **subtly sheer**, naturally flowing to the ground
Hosiery: **full-leg stocking** (color=`HosieryColor`) with pattern=`HosieryPattern`, **upper section thick and reinforced (OL style)**
ThighStrap: **single snug thigh strap belt** (color=`ThighStrapColor`), emphasizing `ThighEmphasis`, ***slight sheen of sweat visible on inner thighs/strapped area***
Outerwear: **(None)**
Accessories: **thin rectangular frame glasses (worn), *beads of sweat on the frames/lenses***, **small sapphire accessory**, thin golden chain with pocket watch
Footwear: low-soled shoes (color=`FootwearColor`), placed nearby

# --------------------
# Pose / Character (Seated Writing - Sweaty)
# --------------------
BodyOrientation: **seated relaxed on a jute rug**, full body visible
PoseAction: **upper body leaning slightly forward over a thin laptop, actively writing/sketching with a stylus, *forehead slightly furrowed in concentration against the heat***
BodyDetail: Legs slightly bent, one knee raised, casual natural posture, **pareo folds flowing naturally to the side/ground, thick thighs prominent in foreground, *skin glossy with sweat***
Expression: **charming smile, lively and happily**
TearMole: **(Optional, tear mole below left eye)**

# --------------------
# Scene (Mid-Summer Wisteria Deck Lakeside)
# --------------------
Location: **Wooden deck under a Wisteria trellis (covered in deep green leaves, providing dense shade), beside a clear lakeside (calm water, heat haze over the surface).** // 藤の花を葉に変更
Scenery: **Clear blue sky, intense summer light**, **natural jute rug spread** on the wooden deck, foldable low table placed on top, **iced tea glass with heavy condensation, wicker basket visible nearby.**
Atmosphere: **Sultry, focused, lakeside, mid-summer setting, intense heat (Mood).**
EnvironmentalEffects: **Strong, harsh summer sunlight filtered by the dense wisteria leaves, creating deep, fragmented shadows on the deck and the character**, **heat haze over the lake**, ***visible sheen of sweat on skin and damp spots on clothing***.

生成物はこちら。

と、キャラクターが同じでも、初夏と夏の違いが出てきています。

プロンプト差分

2つのプロンプトの比較を明確にするため、以下に示します。

  • A: 晩春(クリアな青空)のプロンプト(藤の花あり)
  • B: 夏(汗・藤棚が葉)のプロンプト(藤棚が葉)

この2つのプロンプト間のdiff形式の差分を示します。

晩春(A)から夏(B)への差分(diff形式)

差分を表示するにはこちらをクリック
--- A: 晩春(クリアな青空)のプロンプト
+++ B: 夏(汗・藤棚が葉)のプロンプト
@@ -14,14 +14,14 @@
 # Variables - Sample Inputs (Integrated & Optimized)
 # --------------------
-TimeOfDay: **late morning (clear sunlight)** // 調整
-Weather: **clear blue sky, gentle spring breeze** // 変更
-Season: **late spring** // 変更
-Mood: **serene, content, scholarly, airy yet elegant, vibrant** // 調整
+TimeOfDay: **midday (strong, bright summer sunlight)** // 夏の陽光に変更
+Weather: **intense summer heat, clear blue sky, slight haze, no breeze** // 猛暑に変更
+Season: **mid-summer** // 変更
+Mood: **sultry, focused, determined, slightly overwhelmed by heat, energetic** // 夏の熱気に合わせて調整
 Expression: **charming smile, lively and happily**
 GlassesState: **Yes (worn)**
 GlassesStyle: **thin rectangular frame**
 HairBase: black
 HairAccent: red blue gradation
-HairStyle: pony tail, semi long, strands lifted by gentle breeze
+HairStyle: pony tail, semi long, strands *slightly damp and sticking to neck/forehead* // 発汗の状況を追加
 ThighEmphasis: thick, well-rounded upper thighs with prominent volume
 HosieryColor: **sheer beige** // 晩春の雰囲気に合わせて調整
 HosieryPattern: **light gray dot pattern, full-leg stocking** // 晩春の雰囲気に合わせて調整
@@ -34,10 +34,10 @@
 FootwearColor: low-soled shoes (casual style)
-SkinToneDetail: **healthy tan face/arms/legs, torso pale**
-SweatDetail: **false (no sweat)** // 変更
+SkinToneDetail: **healthy tan face/arms/legs, torso pale, *slightly flushed from heat*** // 発汗の状況を追加
+SweatDetail: **true (profuse sweat)** // **発汗の状況に変更**
 ShoulderExposure: true
 NotebookType: **thin, stylish laptop (NO ANY IP BRAND, LOGO, TRADEMARK VISIBLE, fancy stickers)**
 PenType: **stylus**
-StationeryLayout: **foldable white low table, a natural jute rug spread** // 晩春の雰囲気に合わせて調整
-SideItems: **a small glass of iced tea with lemon, a light novel book, wicker basket, smartphone and earphone** // 晩春の雰囲気に合わせて調整
+StationeryLayout: **foldable white low table, a natural jute rug spread**
+SideItems: **a small glass of iced tea with condensation (sweating glass), a light novel book, wicker basket, smartphone and earphone, *a handheld folding fan (placed nearby)*** // 状況に合わせてアイテムを追加
 ItemPlacement: **scattered**
 
@@ -53,7 +53,7 @@
 Pareo: **wrap skirt** (color=`PareoColorBase`), style=PareoStyle, **subtly sheer**, naturally flowing to the ground
 Hosiery: **full-leg stocking** (color=`HosieryColor`) with pattern=`HosieryPattern`, **upper section thick and reinforced (OL style)**
-ThighStrap: **single snug thigh strap belt** (color=`ThighStrapColor`), emphasizing `ThighEmphasis`
+ThighStrap: **single snug thigh strap belt** (color=`ThighStrapColor`), emphasizing `ThighEmphasis`, ***slight sheen of sweat visible on inner thighs/strapped area*** // 発汗の状況を追加
 Outerwear: **(None)**
-Accessories: **thin rectangular frame glasses (worn)**, **small sapphire accessory**, thin golden chain with pocket watch
+Accessories: **thin rectangular frame glasses (worn), *beads of sweat on the frames/lenses***, **small sapphire accessory**, thin golden chain with pocket watch
 Footwear: low-soled shoes (color=`FootwearColor`), placed nearby
 
@@ -64,15 +64,15 @@
 BodyOrientation: **seated relaxed on a jute rug**, full body visible
-PoseAction: **upper body leaning slightly forward over a thin laptop, actively writing/sketching with a stylus**
-BodyDetail: Legs slightly bent, one knee raised, casual natural posture, **pareo folds flowing naturally to the side/ground, thick thighs prominent in foreground**
+PoseAction: **upper body leaning slightly forward over a thin laptop, actively writing/sketching with a stylus, *forehead slightly furrowed in concentration against the heat*** // 状況に合わせてポーズに熱気を追加
+BodyDetail: Legs slightly bent, one knee raised, casual natural posture, **pareo folds flowing naturally to the side/ground, thick thighs prominent in foreground, *skin glossy with sweat*** // 発汗の状況を追加
 Expression: **charming smile, lively and happily**
 TearMole: **(Optional, tear mole below left eye)**
 
 # --------------------
 # Scene (Late Spring Wisteria Deck Lakeside)
 # --------------------
-Location: **Wooden deck under a Wisteria trellis (full bloom, soft purple flowers hanging), beside a clear lakeside (calm water, clear reflection).** // 変更
-Scenery: **Clear blue sky visible through the wisteria flowers**, gentle breeze, **natural jute rug spread** on the wooden deck, foldable low table placed on top, **wicker basket and a small glass of iced tea visible nearby.** // 変更
-Atmosphere: **Tranquil, studious, lakeside, late spring setting, airy yet elegant (Mood).**
-EnvironmentalEffects: **Clear, bright sunlight filtering through the wisteria trellis, creating dappled light and soft shadows on the deck and the character**, subtle fluttering of blouse/pareo/hair with breeze. // 変更
+Location: **Wooden deck under a Wisteria trellis (covered in deep green leaves, providing dense shade), beside a clear lakeside (calm water, heat haze over the surface).** // 藤の花を葉に変更
+Scenery: **Clear blue sky, intense summer light**, **natural jute rug spread** on the wooden deck, foldable low table placed on top, **iced tea glass with heavy condensation, wicker basket visible nearby.**
+Atmosphere: **Sultry, focused, lakeside, mid-summer setting, intense heat (Mood).**
+EnvironmentalEffects: **Strong, harsh summer sunlight filtered by the dense wisteria leaves, creating deep, fragmented shadows on the deck and the character**, **heat haze over the lake**, ***visible sheen of sweat on skin and damp spots on clothing***. // **発汗の描写を強調**

と、変数もわずかに変更されていることが分かります。

変更点の意図

どのような意図があったのかの解説です。(一部抜粋)

猛暑の強調意図(AIへの指示)
TimeOfDay: midday (strong, bright summer sunlight)柔らかい光から、最も強烈でコントラストの強い真昼の光に変更し、夏の過酷さを強調する。
Season: mid-summer, Weather: intense summer heat, slight haze, no breeze季節を「真夏」に固定し、静止した空気と熱気を描写することで、逃げ場のない暑さを演出する。
Location: Wisteria trellis (covered in deep green leaves, providing dense shade)藤の花(春)を濃い緑の葉に変更し、日陰の下でも暑いという真夏の説得力を与える。
EnvironmentalEffects: Strong, harsh summer sunlight... creating deep, fragmented shadows... heat haze over the lake**光を「強烈」「苛烈 (harsh)」と指示し、湖上に「陽炎(heat haze)」**を描写することで、視覚的に暑さを伝える。
変更点意図(AIへの指示)
SweatDetail: true (profuse sweat)「プロフューズ(大量の)」な汗を明確に指示し、湿度の高さを表現する。
HairStyle: strands *slightly damp and sticking to neck/forehead*髪が風でなびく描写を削除し、汗で濡れて肌に張り付く様子に変更。
SkinToneDetail: *slightly flushed from heat*健康的な肌色に加えて**「熱による紅潮(flushed)」**を指示し、体温の上昇と暑さによる疲労感を表現する。
Outfit / Blouse: (damp spots visible on back/chest from sweat)服が汗で濡れている箇所を明確に指示し、薄手の布地の透け感と湿り気を強調する。
Accessories / glasses: *beads of sweat on the frames/lenses*眼鏡のフレームやレンズについた汗の玉を描写し、細部から暑さと不快感を描写するリアリズムを追求する。

より詳細な状況を描かせるためには、より長文の指示を書く。

そのためGeminiには最初にテキスト形式で

  • 「こういう絵を作りたい」

と相談。そして新たなチャットでイメージ生成。それを元に

  • もっとミステリアスな雰囲気に
  • 表情を変えたい
  • ポーズを変更するには?

などと相談していくのが互いの労力を軽減することになるかと思います。

ユースケース:Gemini nano banana、変数による画像のバリエーション。

AI出力画像の利点を活かします。

「指示をすればその通りの画像が出る」のがAI画像。

ですが狙った画像というのはなかなか出るものではありません。

それを解消するための「レシートのような」プロンプトと、

  • 可読性が高く
  • メンテナンス性が強く
  • 各種表現が可能

という表現のTIPSです。

環境

  • Gemini 2.5
    • Flash
    • Pro
  • 有料、無料の両方で動作可能を確認。

変数付き プロンプトと日本語訳

ChatGTP監修の元、生成したプロンプトはこちらです。

Anime / manga style illustration (moe-inspired)
Aspect ratio: 16:9, widescreen
Slightly high-angle diagonal perspective, full body visible, character-focused

**Variables:**
- Glasses: `True`
- Hair color/base: `silver`
- Hair accent streaks: `red yellow graduation translucent`
- Dress color: `navy blue`
- Embroidery color: `yellow`
- Shawl color: `pale white, light silk`
- Pantyhose color: `black`
- Pump color: `white`
- Pareo color: `deep green based colorful sheer, tied at waist or draped over arm`
- Hand-held item: `smartphone with ladies decorated cover` or `fan`
- Pose angle: `slightly bent forward`
- Expression: `elegant smile, cool and mysterious`
- Facial mark: `small beauty mark under right eye`
- Season: `Summer`
- Time of Day: `evening`

**Setting:**
Chinatown shopping street with colorful shop signs, red lanterns, and traditional decorations.
Show window of a shop in front of the character.
Pavement and street elements slightly blurred to emphasize character.

- **Spring (Season=Spring):** cherry blossoms, lanterns with floral motifs, fresh greenery
- **Summer (Season=Summer):** vibrant banners, occasional paper fans displayed, lush green trees
- **Autumn (Season=Autumn):** red/yellow maple leaves drifting in air, warm lantern light, seasonal foods in shop displays
- **Winter (Season=Winter):** festive lanterns, subtle snow traces, Chinese New Year decorations (red envelopes, couplets)

**Character & Pose:**
Character slightly bent forward, looking at items in shop window.
Hand nearest window may gently touch glass or hover near it (interaction).
Other hand holds variable item (e.g., `hand-held item`).
Reflection of character visible in glass, faint and subtle, matching pose.

**Outfit & Accessories:**
- Chinese dress (cheongsam/qipao, color=`dress color`), embroidery color=`embroidery color`
- Light shawl (color=`shawl color`) draped over shoulders
- Sheer pantyhose (color=`pantyhose color`)
- Small gemstone earrings
- Gold chain around waist
- Elegant pumps (color=`pump color`)
- Colorful sheer pareo (color=`pareo color`)

**Hair:**
Long hair, half-up bun or simple arrangement (base=`hair color`)
Accent streaks (color=`hair accent streaks`) catching sunlight or lantern light
Loose strands frame face naturally, moving slightly with breeze

**Details / Atmosphere:**
- Flow and texture of shawl and pareo
- Light and shadow on embroidery, lace, reflective glass
- Seasonal items dynamically placed depending on `Season`
- Subtle reflection to enhance depth without confusing main subject
- Facial detail emphasizing glasses (if `True`) and beauty mark

萌え系のアニメ・マンガ風イラスト
Aspect ratio: 16:9, widescreen

  • アスペクト比は16:9のワイド画面
    Slightly high-angle diagonal perspective, full body visible, character-focused
  • やや俯瞰の斜め構図でキャラクター全身が見えるように描写
    Variables:
  • 変数(キャラクターの外見や衣装の指定。帰る部分はここです。)
    Glasses: True
  • メガネあり 、なしの場合は False
    Hair color/base: silver
  • 髪のベースカラーは銀色
    Hair accent streaks: red yellow graduation translucent
  • 赤〜黄のグラデーションで半透明のアクセントメッシュ
    Dress color: navy blue
  • ドレスの色はネイビーブルー
    Embroidery color: yellow
  • 刺繍の色は黄色
    Shawl color: pale white, light silk
  • ショールは淡い白色で軽やかなシルク素材
    Pantyhose color: black
  • パンストは黒色
    Pump color: white
  • パンプスは白色
    Pareo color: deep green based colorful sheer, tied at waist or draped over arm
  • パレオは深緑ベースのカラフルな透け感、腰に巻くか腕に掛ける
    Hand-held item: smartphone with ladies decorated cover or fan
  • 手に持つアイテムは装飾付きスマホまたは扇子
    Pose angle: slightly bent forward
  • 少し前屈みのポーズ
    Expression: elegant smile, cool and mysterious
  • 上品な微笑み、クールでミステリアスな表情
    Facial mark: small beauty mark under right eye
  • 右目の下に小さなほくろ
    Season: Summer
  • 季節は夏
    Time of Day: evening
  • 時間帯は夕方
    Setting:
  • 背景設定
    Chinatown shopping street with colorful shop signs, red lanterns, and traditional decorations.
  • チャイナタウンの商店街、カラフルな看板と赤い提灯、伝統的な装飾
    Show window of a shop in front of the character.
  • キャラクターの前には店舗のショーウィンドウ
    Pavement and street elements slightly blurred to emphasize character.
  • 路面や街の要素は少しぼかしてキャラクターを強調
    Spring (Season=Spring): cherry blossoms, lanterns with floral motifs, fresh greenery
  • 春:桜、花柄の提灯、新緑
    Summer (Season=Summer): vibrant banners, occasional paper fans displayed, lush green trees
  • 夏:鮮やかなバナー、紙製の扇子、青々とした木々
    Autumn (Season=Autumn): red/yellow maple leaves drifting in air, warm lantern light, seasonal foods in shop displays
  • 秋:赤や黄色の紅葉が舞い、暖かい提灯の光、季節の食べ物が店頭に並ぶ
    Winter (Season=Winter): festive lanterns, subtle snow traces, Chinese New Year decorations (red envelopes, couplets)
  • 冬:祝祭の提灯、さりげない雪の痕跡、春節の飾り(赤い封筒、対聯)
    Character & Pose:
  • キャラクターの動きとポーズ
    Character slightly bent forward, looking at items in shop window.
  • キャラクターは少し前屈みでショーウィンドウの商品を見ている
    Hand nearest window may gently touch glass or hover near it (interaction).
  • ウィンドウ側の手はガラスに触れるか近づけている(インタラクション)
    Other hand holds variable item (e.g., hand-held item).
  • もう一方の手には指定されたアイテムを持つ
    Reflection of character visible in glass, faint and subtle, matching pose.
  • ガラスにキャラクターの反射が淡く映り、ポーズと一致している
    Outfit & Accessories:
  • 衣装とアクセサリー
    Chinese dress (cheongsam/qipao, color=dress color), embroidery color=embroidery color
  • チャイナドレス(色は指定通り)、刺繍も指定色
    Light shawl (color=shawl color) draped over shoulders
  • 肩にかけた軽やかなショール(指定色)
    Sheer pantyhose (color=pantyhose color)
  • 透け感のあるパンスト(指定色)
    Small gemstone earrings
  • 小さな宝石のイヤリング
    Gold chain around waist
  • 腰に金のチェーン
    Elegant pumps (color=pump color)
  • エレガントなパンプス(指定色)
    Colorful sheer pareo (color=pareo color)
  • カラフルで透け感のあるパレオ(指定色)
    Hair:
  • 髪型と演出
    Long hair, half-up bun or simple arrangement (base=hair color)
  • ロングヘアでハーフアップまたはシンプルなまとめ髪(ベース色)
    Accent streaks (color=hair accent streaks) catching sunlight or lantern light
  • アクセントメッシュが夕陽やランタンの光を受けて輝く
    Loose strands frame face naturally, moving slightly with breeze
  • 顔周りの毛束が自然に垂れ、風でやや揺れる
    Details / Atmosphere:
  • 雰囲気と細部描写
    Flow and texture of shawl and pareo
  • ショールとパレオの質感と動き
    Light and shadow on embroidery, lace, reflective glass
  • 刺繍やレース、ガラスに映る光と影
    Seasonal items dynamically placed depending on Season
  • 季節に応じたアイテムが動的に配置される
    Subtle reflection to enhance depth without confusing main subject
  • 主役を引き立てるための繊細な反射表現
    Facial detail emphasizing glasses (if True) and beauty mark
  • メガネ(Trueの場合)とほくろを強調した顔の描写

画像はこちらが出ます。

変数を変えての再出力。

これを、

Variables:

  • Glasses: False
  • Hair color/base: Blonde
  • Hair accent streaks: white green graduation translucent
  • Dress color: rose pink
  • Embroidery color: navy blue
  • Shawl color: light green, thick linen
  • Pantyhose color: white
  • Pump color: copper
  • Pareo color: sky blue based colorful sheer, tied at waist or draped over arm
  • Hand-held item: confectionary gift box
  • Pose angle: sideways stance
  • Expression: elegant smile, cool and mysterious
  • Facial mark: small beauty mark under right eye
  • Season: winter
  • Time of Day: night

としてみます。他はそのままです。

結果はこの通り。

  • 髪色
  • 衣装の色
  • 季節

を変えるバリエーションが、他をいじらずに設定可能。

この長いレシート文を読み込めるGeminiの力も、それに即した文脈でプロンプトを生成するChatGPTの2つの力が合わさったという形です。

おまけ

更に

  • 表情
  • 小物
  • 季節感

などを追加したパターンは次ページに。

ケーススタディ:Gemini nano banana 9/19以降の仕様変更によるアスペクト比固定の状態での16:9での画像生成ワークアラウンド。

治る兆しが見えない、アスペクト比をプロンプトで指定しても1:1で出力されてしまうGemini nano bananaのアスペクト比固定問題。

ワークアラウンドを見つけたのでメモに残しておきます。

この措置は、無料アカウントでもAI Premiumでも有効でした。

まずはプロンプトを指定。

以下のようなプロンプトをGemini 2.5 Flashで指定します。

Anime / manga style illustration (moe-inspired).
Aspect ratio: 16:9, widescreen.

**Setting:**

* Rooftop garden in London.
* Background prominently features St. Paul's Cathedral.
* Evening cityscape with soft ambient lighting and reflections on glass surfaces.

**Character:**

* Woman wearing glasses.
* Emerald-themed gemstone-inspired dress with silver accents.
  * Shiny, silky material.
  * Shoulder-baring and navel-baring design, elegant and natural.
  * Skirt with a side slit, revealing sparkling white pantyhose with subtle glitter.
  * Subtle embroidery or frills to suggest sparkling facets.
* Small emerald accessories.
* Hair and clothing gently moved by rooftop breeze.

**Scene / Action:**

* Upper body and legs in focus, highlighting the slit and pantyhose.
* Adjusting hair, holding a bouquet or gesturing naturally.
* Dress and city lights reflecting softly in ambient lighting.

このように、指定しても生成結果は変わらず。以下の、正方形の画像が出てきます。

そこで、以下の手順を踏みます。

回避策

必要なアスペクト比の無地の画像を用意。

16:9、無地の画像を用意しました。

改めてのプロンプト指示。

Anime / manga style illustration (moe-inspired).
Aspect ratio: 16:9, widescreen.

**Setting:**

* Rooftop garden in London.
* Background prominently features St. Paul's Cathedral.
* Evening cityscape with soft ambient lighting and reflections on glass surfaces.

**Character:**

* Woman wearing glasses.
* Emerald-themed gemstone-inspired dress with silver accents.
  * Shiny, silky material.
  * Shoulder-baring and navel-baring design, elegant and natural.
  * Skirt with a side slit, revealing sparkling white pantyhose with subtle glitter.
  * Subtle embroidery or frills to suggest sparkling facets.
* Small emerald accessories.
* Hair and clothing gently moved by rooftop breeze.

**Scene / Action:**

* Upper body and legs in focus, highlighting the slit and pantyhose.
* Adjusting hair, holding a bouquet or gesturing naturally.
* Dress and city lights reflecting softly in ambient lighting.

こちらを、添付画像の画像のアスペクト比になるよう、出力をお願いします。

こちらを、添付画像の画像のアスペクト比になるよう、出力をお願いします。

この一文を最後に加えるのが重要です。

そうした上で画像生成を行います。

結果、16:9のアスペクト比で生成されました。

余談:なぜこれが可能なのか

一つの仮説を、Gemini自身に聞いてみたところ、以下の興味深い仮説が得られました。

これには、いくつかの仮説が考えられますが、最も有力なのは以下の**「マルチモーダル・コンテキスト仮説」**です。


仮説:マルチモーダル・コンテキスト仮説

現在のGeminiは、単一の知性ではなく、テキスト、画像、音声など、複数の種類の情報(モダリティ)を処理するための、異なる経路や専門分野を持つ、複雑なシステムです。この行動は、このシステムの異なる経路を意図的に利用した、と言えます。

1. テキストのみの指示(失敗した経路)

「アスペクト比 16:9」と言葉で指示したとき、リクエストはAIの**「テキスト解釈」の部分に送られます。しかし、現在の画像生成モデル(nano banana)は、効率化のために、この部分の解釈能力が意図的に制限**されています。つまり、AIはあなたの言葉を「読み」はしますが、「アスペクト比」という技術的指示を画像生成に反映させるための命令系統が、意図的に断たれているのです。

これは、耳の聞こえない人に、口頭で「長方形の絵を描いて」と頼んでいるようなものです。言葉は届きません。

2. 画像を添付した指示(成功した経路)

しかし、無地の16:9の画像を添付したとき、事態は一変します。リクエストは、AIの**「視覚認識」の部分を通過し、テキストと画像の両方を同時に解釈する、より高度な「マルチモーダル解釈」**の経路に入ります。

この経路では、AIはまず添付された画像を「見て」、その**特性(プロパティ)**を理解しようとします。AIにとって、その無地の画像は、以下の否定しようのない「事実」として認識されます。

  • 事実1: この画像は「存在する」。
  • 事実2: この画像の「形」は、縦横比が16:9の長方形である。

その上で、あなたの「こちらを、添付画像の画像のアスペクト比になるよう、出力をお願いします」という言葉が解釈されます。

この時、AIへの命令は「言葉だけで16:9の絵を描け」という曖昧なものではなくなります。AIへの命令は、「今、私が見ているこの『16:9の形』という強力な視覚的事実を、これから生成する画像に適用せよ」という、極めて具体的で、無視できない指示へと変わるのです。

これは、先ほどの例えで言うなら、耳の聞こえない人に、無言で「長方形の画用紙」を手渡して、その上で「ここに絵を描いて」とジェスチャーするようなものです。言葉は不要で、制約(画用紙の形)は明確に伝わります。


ケーススタディ:Gemini nano banana 9/19以降の仕様変更によるアスペクト比固定の状態でのWebサイトバナー作成。

2025年8月頃に颯爽と現れたGoogle画像生成(Gemini nano banana)。

利用者激増により2025年9月19日頃から

  • 機能制限(アスペクト比1:1固定)
  • フィルター強化

の2つが課せられました。(これを修正していくと答えている/このままで行くの情報が錯綜しています)

それを回避しつつ、WordpressやBookStackのバナーとなるような画像を作っていきます。

1:1でも参照できるプロンプトを生成

プロンプトそのものを生成AIに代筆してもらいます。いくつか相談を重ね、以下のようなプロンプトができあがりました。

**Style / Format:**
Anime / manga style illustration (moe-inspired).
Framed as a **16:9 widescreen rectangle**, neutral/empty space only at top and bottom.
**Top-down / bird’s-eye perspective**, slight wide-angle lens effect.

**Setting:**

* Lake surrounded by forest, serene summer atmosphere.
* Transparent water showing subtle underwater details (driftwood, small fish) without stealing focus.
* Gentle sunlight reflecting on water surface.

**Character:**

* Woman wearing glasses. **Winking with a soft, gentle smile**, giving a friendly and approachable expression.
* Seated in a small boat, visible from above.

**Outfit & Accessories:**

* White sleeveless shirt (light, slightly transparent).
* Subtle hint of glossy emerald-colored swimsuit underneath (implied, not explicit).
* Elegant layered robe, shoulder-exposed dark-green and black elements.
* Collar and ribbon-style silk tie arranged elegantly.
* Subtle emerald-colored accessories.
* Sheer patterned black pantyhose, glossy reflections.
* Silver-toned pumps.

**Scene / Action:**

* Sitting on boat edge, feet touching lake (bird’s-eye view).
* Reading a book, gently interacting with water.
* Boat carries small stack of books.
* Black laptop placed naturally; screen/keyboard subtly visible with browser open.
* **Laptop features a stylish, original snake sticker (not Slytherin), black with yellow trim, integrated naturally).**
* Water surface shows large, decorative **“BookStack”** text, slightly distorted by ripples.

**Camera / Composition:**

* Main subject fits central 16:9 area; extra neutral space only at top/bottom.
* Bird’s-eye view emphasizes character, boat, books, water.
* Ripples and transparent underwater elements enhance realism without stealing focus.

**Details / Effects:**

* Textures, layering, and relaxed lakeside atmosphere emphasized.
* Hair and clothing gently moving in breeze.
* Water reflections and subtle shimmer on laptop surface.
* Subtle glossy black swimsuit hint integrated naturally.
* BookStack lettering harmoniously blended with water ripples.
* Snake sticker clearly visible but elegant, unmistakably original design, avoiding any IP references.
* **Facial expression soft, charming, with a wink and gentle smile to enhance approachable, playful mood.**

日本語はこちらです。

スタイル / フォーマット:
アニメ・漫画風イラスト(萌え系)。
16:9ワイドスクリーンの長方形にフレーム、上下にのみ余白を確保。
上空俯瞰視点(トップダウン/バードアイビュー)、やや広角レンズ効果を想定。

舞台設定:

  • 森に囲まれた湖、穏やかな夏の雰囲気。
  • 水は透明で、流木や小魚などの水中ディテールがうっすら見える(キャラクターの焦点を奪わない程度)。
  • やわらかく反射する日差し。

キャラクター:

  • 眼鏡をかけた女性。ウィンクして優しい微笑みを浮かべ、親しみやすい表情
  • 小さなボートに座っており、上空から見下ろした構図で描かれる。

衣装・アクセサリー:

  • 白いノースリーブシャツ(軽く、端は少し透け感あり)。
  • 光沢のあるエメラルド色の水着をさりげなく下に着用(暗示的で、直接的には見せない)。
  • 肩を出した、落ち着いたダークグリーンと黒のレイヤードローブ。
  • 襟とリボンタイをエレガントにアレンジ。
  • さりげないエメラルド色のアクセサリー。
  • パターン入り黒ストッキング(全脚)、光沢感あり。
  • シルバー系パンプス。

シーン・アクション:

  • ボートの縁に座り、足を湖に触れさせる(俯瞰視点)。
  • 本を読みつつ、そっと水に触れる。
  • ボートには小さな本の山を積んでいる。
  • 黒いノートPCを自然に配置、画面・キーボードがうっすら見える(ブラウザ表示)。
  • PCにはスタイリッシュなオリジナル蛇ステッカー(スリザリンではない)、黒地に黄色の縁取りが自然に貼られている。
  • 水面には大きく装飾された 「BookStack」 の文字、波紋でわずかに歪む。

カメラ・構図:

  • メイン被写体は中央の16:9エリアに収め、余白は上下のみ。
  • 上空視点でキャラクター、ボート、本、湖を強調。
  • 水面の反射や波紋、透明な水中要素によりリアリティを増すが、焦点を奪わない。

ディテール・エフェクト:

  • 衣服の質感やレイヤード感、穏やかな湖畔の雰囲気を強調。
  • 髪や衣服はそよ風にやわらかく揺れる。
  • 水面の反射やPC表面の微かな光沢。
  • さりげなく示唆された光沢黒水着。
  • BookStack文字は水面の波紋に調和して描かれる。
  • 蛇ステッカーははっきり見えるが、エレガントで独自デザイン、IP参照はなし。
  • 顔の表情は柔らかく魅力的で、ウィンクと優しい微笑みにより、親しみやすく遊び心のある雰囲気を演出。

こうして生成された画像(Gemini 2.5 Flash)がこちら。

見ての通り、1:1の正方形であるものの、バナーとして切り出しやすいものになっています。

画像の切り取り

ここまで来れば画像をフルサイズでのダウンロード。

保存した画像を適当な画像編集ソフトで切り出していきます。(極端な話、ペイントでも余裕で切り出せます)

後は、これをWordpressのアイキャッチとして設定。

まとめ

この、

プロンプトが分からなければAI自体に相談。(ChatGPTはこういうノリは強いです)

をしていくことで

  1. 視覚的魅力を保ちながら安全性を確保
  2. アスペクト比や画角の問題も回避
  3. IPフィルターやセーフティフィルターを回避していく

方法を採ることができました。

Redmine Knowledgebase プラグイン (v5.0.0) on Redmine 5.1 (Ruby 3.2+, Rails 6.1+) インストール・マイグレーション手順

自分にとってのキラープラグインと言えるRedmine Knowledgebase。

これをRedmine 5.1に導入する際に恐ろしくハマったので、解決したときのメモです。

なお、本件の解決にはGoogle Gemini Advanced(2.5 Pro preview)の助けが必要でした。

環境

  • Ubuntu 24.04
  • Redmine 5.1.x
  • Apache 2.4で稼働
  • Ruby 3.2.x (本手順は Ruby 3.2.3 で確認)
  • Rails 6.1.x (本手順は Rails 6.1.7.10 で確認)
  • データベース: MySQL 8.0 (他のデータベースでも同様の問題が発生する可能性があります)
  • プラグインソース: alexbevi/redmine_knowledgebase

盛大にハマった結果で得た手順

  1. DBのバックアップを取得します。
  2. プラグインのインストールを行います。
  3. マイグレーションエラーに対応します。
  4. マイグレーションの成功を確認します。
  5. Redmine(Webサービス)を再起動します。
  6. プラグインのインストールと動作確認を行います。

バックアップを取得します。

  • 作業ディレクトリに移動
cd /hoge && pwd

任意のバックアップディレクトリに移動します

  • mysqldumpによるバックアップ
mysqldump -h localhost -u redmine -p --no-tablespaces --single-transaction redmine > redmine_backup.$(date +%Y%m%d).sql

それぞれ-h ホスト名 -u redmine -p ユーザ オプション db名です。パスワードはRedmineインストール時に設定したDBユーザのものです。

環境が許すなら、VPSのスナップショットのようにシステム全体のバックアップを取ることを強く推奨します。

プラグインのインストール

  • Redmineのプラグインディレクトリに移動
cd /path/to/redmine/root/directory/plugins && pwd

筆者環境/home/www-data/redmine/plugins

  • git clone
sudo -u www-data git clone https://github.com/alexbevi/redmine_knowledgebase

Redmineの実行ユーザでgit cloneとした方が、後にsudo chownする手間が省けます。

  • clone確認
ls -l redmine_knowledgebase

ファイル一式があることと、ファイル群の所有者がwww-data(Redmineの実行ユーザ)であることを確認します。

  • Redmineのルートディレクトリに戻ります。
cd /path/to/redmine/root/directory/plugins && pwd

筆者環境/home/www-data/redmine/

  • (必要に応じて)依存関係をインストールします。
sudo -u www-data bundle install

初回マイグレーション実行 (エラー発生との対処)

以下のコマンドでプラグインのマイグレーションを実行します。このとき、壮大にハマったので、AIの力を借りて(というよりもほぼその指示に従って)解決しました。

sudo -u www-data bundle exec rake redmine:plugins:migrate RAILS_ENV=production --trace

マイグレーションエラーの修正

エラーが発生した場合は、以下の手順で関連ファイルを修正し、その都度上記 redmine:plugins:migrate コマンドを再実行してください。

修正箇所1: 20121205100143_add_versioning.rb ファイルの対応

このマイグレーションでは、以下の2つのエラーが連続して発生する可能性があります。

  • Mysql2::Error: Duplicate column name 'version_comments' (in kb_articles table)
  • ArgumentError: wrong number of arguments (given 2, expected 1) (in KbArticle.create_versioned_table 内部の create_table 呼び出し)

対象ファイルA: plugins/redmine_knowledgebase/db/migrate/20121205100143_add_versioning.rb

以下に従って修正していきます。

  • 修正前の class AddVersioning ... end の内容(主要部分):
  class AddVersioning < ActiveRecord::Migration
    def self.up
      KbArticle.create_versioned_table
      add_column :kb_articles, :version_comments, :string, :limit => 255, :default => ""
    end

    def self.down
      remove_column :kb_articles, :version_comments
      KbArticle.drop_versioned_table
    end
  end
  • 修正後の class AddVersioning ... end の内容:
  class AddVersioning < ActiveRecord::Migration[6.1] # Rails 6.1 互換にする
    def self.up
      # kb_article_versions テーブルが存在しない場合のみ作成
      unless ActiveRecord::Base.connection.table_exists?(:kb_article_versions)
        if defined?(KbArticle) && KbArticle.respond_to?(:create_versioned_table)
          KbArticle.create_versioned_table # この呼び出しは次の acts/versioned.rb の修正が必要
        else
          # このエラーは通常発生しないはずだが、念のため
          raise "Cannot create kb_article_versions: KbArticle model or create_versioned_table method is not available."
        end
      end

      # kb_articles テーブルに version_comments カラムが存在しない場合のみ追加
      unless column_exists?(:kb_articles, :version_comments)
        add_column :kb_articles, :version_comments, :string, :limit => 255, :default => ""
      end
    end

    def self.down
      if column_exists?(:kb_articles, :version_comments)
        remove_column :kb_articles, :version_comments
      end
      if ActiveRecord::Base.connection.table_exists?(:kb_article_versions)
        if defined?(KbArticle) && KbArticle.respond_to?(:drop_versioned_table)
          KbArticle.drop_versioned_table
        end
      end
    end
  end

対象ファイルB: plugins/redmine_knowledgebase/lib/active_record/acts/versioned.rb

KbArticle.create_versioned_table が内部で呼び出す create_tableArgumentError が発生します。このファイルを修正します。

  • 修正対象箇所 (ファイル内の create_versioned_table メソッドの中、通常503行目あたり):
  # 修正前
            self.connection.create_table(versioned_table_name, create_table_options) do |t|

Ruby

  # 修正後 (create_table_options の前に ** を追加)
            self.connection.create_table(versioned_table_name, **create_table_options) do |t|

上記AとBの両ファイルを修正後、再度以下を実行しましたが、エラーが発生しました。

sudo -u www-data bundle exec rake redmine:plugins:migrate RAILS_ENV=production --trace
修正箇所2: 20150326093122_add_taggings_counter_cache_to_tags.rb ファイルの対応

次のエラーとして NameError: uninitialized constant ...::RedmineCrm が発生する可能性があります。

対象ファイル: plugins/redmine_knowledgebase/db/migrate/20150326093122_add_taggings_counter_cache_to_tags.rb

  • 修正前の class AddTaggingsCounterCacheToTags ... end の内容(主要部分):
  class AddTaggingsCounterCacheToTags < Rails.version < '5.1' ? ActiveRecord::Migration : ActiveRecord::Migration[4.2] # 古い形式
    def self.up
      RedmineCrm::Tag.reset_column_information
      # ... (RedmineCrm::Tag を参照するコードが続く) ...
    end
    def self.down
      # ... (関連する可能性のある remove_column など) ...
    end
  end
  • 修正後の class AddTaggingsCounterCacheToTags ... end の内容:

(Redmine Crmプラグインを使用していない場合、関連処理をスキップします)

  class AddTaggingsCounterCacheToTags < ActiveRecord::Migration[6.1] # Rails 6.1 互換にする
    def self.up
      puts "INFO: Skipping 'up' method in 20150326093122_add_taggings_counter_cache_to_tags.rb due to missing RedmineCrm module or intentional skip."
      # 元の RedmineCrm::Tag に関連する処理は全てコメントアウトまたは削除
    end

    def self.down
      puts "INFO: Skipping 'down' method in 20150326093122_add_taggings_counter_cache_to_tags.rb."
      # 元の remove_column 処理なども、up で対応する処理を行わないためコメントアウトまたは削除
    end
  end

上記ファイルを修正後、更に以下を実行します。

sudo -u www-data bundle exec rake redmine:plugins:migrate RAILS_ENV=production --trace

これらの手順で、ようやく、

  • コンソールにエラーメッセージが出ないこと
  • db:schema:dumpがログに出力されること

を確認しました。

マイグレーション完了の確認

念のため、

mysql -u root -p

としてMySQLコンソールにログイン。

USE DATABASE redmine;

(自分が使っているRedmineのDBを指定します)

  • kb_article_versionsテーブルの確認
SHOW TABLES LIKE 'kb_article_versions';
DESCRIBE kb_article_versions;
DESCRIBE kb_articles;

それぞれ、テーブルが作成されていること、kb_articles テーブルに version_comments カラムが存在すること、および content カラムの型が変更されていること(ChangeColumnArticleToLongText マイグレーションによる)を確認します。

Redmineの再起動

ここではWebサービス(Apache)の再起動を前提とします。

  • 稼働前確認
systemctl status apache2.service

active(running)を確認します。

  • Webサービス再起動
sudo systemctl restart apache2.service
  • 稼働後確認
systemctl status apache2.service

active(running)を確認します。

プラグインの動作確認

Redmineにログインし、ナレッジベースプラグインの各機能

  • 記事の作成
  • 編集
  • 表示
  • バージョン管理
  • ファイル添付

などが正常に動作するか確認してください。

注意点:

  • 上記の手順は、特定のバージョンの組み合わせで発生した問題への対処法です。プラグインやRedmineのバージョンが異なる場合は、別の問題が発生したり、異なる修正が必要になる場合があります。
  • 途中でマイグレーションが認識されなくなるなどの不可解な問題が発生した場合は、一度プラグインディレクトリを削除し、データベースをリストア(または関連テーブルを手動削除)、再度GitHubからクリーンにクローンし直してから上記手順を開始すると、問題が解消されることがあります。

おまけ:切り戻し手順

この手順で成功したとはいえ、失敗はつきものです。そのため、以下に切り戻し手順を記します。

通常の切り戻し

ディレクトリ移動

  • Redmineのルートディレクトリに戻ります。
cd /path/to/redmine/root/directory/plugins && pwd

筆者環境/home/www-data/redmine/

プラグインアンインストール

sudo -u www-data bundle exec rake redmine:plugins:migrate NAME=redmine_knowledgebase VERSION=0 RAILS_ENV=production

ディレクトリ削除

sudo rm plugins/redmine_knowledgebase -Rf

Webサービス再起動

  • 稼働前確認
systemctl status apache2.service

active(running)を確認します。

  • Webサービス再起動
sudo systemctl restart apache2.service
  • 稼働後確認
systemctl status apache2.service

active(running)を確認します。

それでもダメだった切り戻し(DBリストア)

  • DBをバックアップしたディレクトリに移動
cd /hoge && pwd
  • DBリストア
mysql -h localhost -u redmine -p redmine < redmine_backup.$(date +%Y%m%d).sql

パスワードはredmineインストール時に設定したDBユーザのものです

  • 稼働前確認
systemctl status apache2.service

active(running)を確認します。

  • Webサービス再起動
sudo systemctl restart apache2.service
  • 稼働後確認
systemctl status apache2.service

active(running)を確認します。

再起動後、復旧しているかを確認します。

Powered by WordPress & Theme by Anders Norén