カテゴリー: 未分類 Page 1 of 16

文具と飾り。

ちょっとしたプレゼントをもらいました。

『ハリー・ポッターとアズカバンの囚人』タイムターナー。

早速の取り付け、既に取り付けてあるグリフィンドールの紋章ともピッタリ。

こういう飾りのために各所にハードポイントをつけてくれた母には感謝です

手間の簡略化。

iPhoneAIRに買い換えた際についでに買った充電器。

「安いから」「置くだけだし」思いながら買ったのはいいのですが

  • 固定しないとずれる
  • 確実に充電されない

などの問題点があり、それなら普通にUSBに挿すだけでいいのではという根源的な疑問にたどり着きました。

ニトリにて見つけた充電器つきの置き時計。

見た目はインテリアにも映えるモダンでシンプルなデジタル時計ですが

この置くだけ充電は、ずれようがないのが魅力。

「運用が大変ならば設計から変える」

のシンプルな答えでした。

Gemini Nanobanana 3.0の性勢力の威力。

制度や画面性勢力が向上したNanobanana 3.0。その検証です。

Flash (高速モード)での描画

臨場感はこの時点でもかなりあります。

Pro(思考モード)での描画

なんと、基本が横長画像。

見てお分かりのように、よりリアルなライブ感が足され、魔法のエフェクトもたされています。

画像合成

では、この4つのGeminiで

生成された4人のライブシーン。これを「1つのライブ会場で演奏させる」というのを指示してみます。

  • ドラムが前向きに修正され
  • それぞれにスポットライトが当てられ
  • 観客も足されている

と、恐るべき制度での合成がありました。

ここまで進化したGoogleAIの力に改めて驚嘆です。

シェルスクリプト:top-proc.shの改修。

以前のシェルスクリプト、メモリとCPU使用率を見るスクリプトを改修しました。

改修後のスクリプト

#!/bin/bash

# スクリプト名: top_procs.sh
# 説明: システム全体の負荷状況と、CPU/メモリ使用率が高い上位プロセスを表示します。

# 表示するプロセス数の設定
TOP_N=5

# ヘルプ表示関数
show_help() {
    echo "--- プロセス監視スクリプト ---"
    echo "このスクリプトは、システム全体の負荷状況(CPU/メモリ/LoadAvg)と、"
    echo "リソース消費が多い上位${TOP_N}つのプロセスを表示します。"
    echo ""
    echo "使用方法: $0 [オプション]"
    echo ""
    echo "オプション:"
    echo "  -c          : CPU使用率 (%\$CPU) の高い上位${TOP_N}つのプロセスを表示します。"
    echo "  -m          : メモリ使用率 (%\$MEM) の高い上位${TOP_N}つのプロセスを表示します。"
    echo "  -a          : CPUとメモリの両方の上位${TOP_N}つのプロセスを表示します。(引数なしと同じ)"
    echo "  -h          : このヘルプを表示します。"
    echo ""
    echo "出力形式: 割合(%) PID COMMAND"
    echo "-----------------------------------------"
}

# システム全体のリソース状況表示関数
show_system_summary() {
    echo "--- システム稼働状況 ---"

    # 1. Load Average (uptimeコマンドから抽出)
    # 出力例: 16:45:23 up 10 days, ... load average: 0.05, 0.03, 0.01
    local load_avg=$(uptime | awk -F'load average:' '{ print $2 }' | xargs)
    echo "Load Average : $load_avg"

    # 2. CPU使用率 (vmstatコマンドから直近1秒の状態を取得)
    # vmstat 1 2 の2行目(最新の状態)を取得し、アイドル率($15)を100から引く
    if command -v vmstat >/dev/null 2>&1; then
        local cpu_idle=$(vmstat 1 2 | tail -1 | awk '{print $15}')
        local cpu_usage=$((100 - cpu_idle))
        echo "CPU Usage    : ${cpu_usage}%"
    else
        echo "CPU Usage    : (vmstatコマンドが見つかりません)"
    fi

    # 3. メモリ使用率 (freeコマンドから計算)
    # free -m の出力を解析
    if command -v free >/dev/null 2>&1; then
        local mem_info=$(free -m | grep Mem:)
        local mem_total=$(echo "$mem_info" | awk '{print $2}')
        local mem_used=$(echo "$mem_info" | awk '{print $3}')
        # awkで浮動小数点計算
        local mem_pct=$(awk "BEGIN {printf \"%.1f\", ${mem_used}/${mem_total}*100}")
        echo "Memory Usage : ${mem_pct}% (${mem_used}MB / ${mem_total}MB)"
    else
        echo "Memory Usage : (freeコマンドが見つかりません)"
    fi
    echo "------------------------"
}

# プロセス情報表示関数
# 引数1: ソート対象 (CPU/MEM)
# 引数2: ソートフィールド番号 (ps auxの3番目か4番目)
# 引数3: タイトル
show_top_procs() {
    local type=$1
    local field=$2
    local title=$3

    echo ""
    echo "--- ${title} (上位 ${TOP_N} プロセス) ---"
    echo " %${type}    PID  COMMAND"
    echo "-----------------------------------------"

    ps aux |
        # ヘッダー行をスキップ
        tail -n +2 |
        # 指定フィールド (CPU:%3, MEM:%4) で降順ソート
        sort -k ${field} -r |
        # 上位N行を抽出
        head -n ${TOP_N} |
        # PID ($2)、割合 ($field)、COMMAND ($11以降) を整形して表示
        awk -v field="${field}" '{
            cmd="";
            for(i=11;i<=NF;i++){
                cmd=cmd" "$i
            };
            # $fieldには$3(%CPU)または$4(%MEM)の値が入る
            printf "%6.2f%% %6s %s\n", $field, $2, cmd
        }'
}

# メインロジック

# まずシステム全体のサマリーを表示 (ヘルプ以外の場合)
if [ "$1" != "-h" ]; then
    show_system_summary
fi

if [ "$#" -eq 0 ] || [ "$1" == "-a" ]; then
    # 引数なし、または -a の場合 (全て表示)
    show_top_procs "CPU" 3 "CPU使用率"
    show_top_procs "MEM" 4 "メモリ使用率"
elif [ "$1" == "-c" ]; then
    # -c の場合 (CPUのみ)
    show_top_procs "CPU" 3 "CPU使用率"
elif [ "$1" == "-m" ]; then
    # -m の場合 (メモリのみ)
    show_top_procs "MEM" 4 "メモリ使用率"
elif [ "$1" == "-h" ]; then
    # -h の場合 (ヘルプ)
    show_help
else
    # 不正な引数の場合
    echo "不正なオプションです: $1" >&2
    show_help
    exit 1
fi

あとはこれに

chmod +x top-proc.sh

で実行権を付与します。

使用例

./top-proc.sh
--- システム稼働状況 ---
Load Average : 1.30, 1.40, 1.32
CPU Usage    : 23%
Memory Usage : 60.5% (3583MB / 5920MB)
------------------------
--- CPU使用率 (上位 5 プロセス) ---
 %CPU    PID  COMMAND
-----------------------------------------
 52.10%  12345  ruby_app_server: /var/www/webapp1 (production)
  9.40%   1086  /usr/sbin/database_server [...]
  3.80%  42162  /usr/sbin/web_server -k start
  1.50%  42161  /usr/sbin/web_server -k start
  0.90%   7978  nodejs_process /path/to/nodejs_app/server.js

--- メモリ使用率 (上位 5 プロセス) ---
 %MEM    PID  COMMAND
-----------------------------------------
 13.10%   1984  /usr/bin/java -Xms256m -Xmx256m [...] search_engine -Des.path.home=/usr/share/search_engine [...]
 10.00%   1086  /usr/sbin/database_server [...]
  7.50%  12345  ruby_app_server: /var/www/webapp1 (production)
  3.90%  78630  ruby_app_server: /var/www/webapp2 (production)
  3.80%  76583  ruby_app_server: /var/www/webapp3 (production)

と出てきます。

  • ロードアベレージ:uptimeコマンドから
  • CPU使用率:vmstatコマンドから直近1秒

として、より現実値に近づけています。

sudo ln -sf /path/to/script/top-procs.sh /usr/local/bin/top-procs

として、どこからでもコマンドを呼び出せるようにしておくといいでしょう。(スクリプトの場所は自分がこれを保存した絶対パスを指定してください)

既にコマンド化している場合は、このスクリプトを差し替えるだけでOKです。

10月の食事ピックアップ。

連休時の話。

お世話になっている肩にご馳走になりました。

伊勢エビ

予想外にも程があった伊勢エビ。過去に数回食べたことがありましたが

この量が出るのは驚きでした。しかし、それ以上に驚きだったのが「これは半身です」と言われたこと。

残りの半身は天ぷら。確かに海老は天ぷらの種としての定番ですが、伊勢エビというのも予想外でした。上品な甘味と歯触り、いずれも素晴らしいものでした。

しかし、話はそれだけでは終わらず。

刺身で出てきた尾頭は具足煮。しかも、前身をこんがりあぶった鬼殻焼きスタイルです。

頭の味噌から出る出汁がたっぷり出ていて、残っていた頭の肉も食べ応え十分。

その他食事

これをその他と言っていいのかは不明ですが:

兜煮。全体は崩れず、味がしっかり染みている当最高の出来。目玉のゼラチン質も最高です。

ご飯は伝統的な塩むすびと

ネギトロ&トロタク。

ここまで贅沢でいいのかという形の、非常に充実した食事でした。

『Elasticsearchを利用しているGrowiでのアップデート注意点(Growi特有のプラグインに起因するサービス停止)』

概要

GrowiでElasticsearchによる全文検索を利用している中でのアップデートの注意点です。なお、Growiをオンプレ運用していてサーバリソースの関係上などでElasticsearchを用いていないという方はここから下は参考程度にとどめてください。

環境

  • Grwoi v7.3.3
  • Elasticsearch v9.2.0
  • Apacheによるリバースプロキシ

パッケージアップデート時の注意

sudo aptitude upgrade

(※筆者は好みでaptitudeを使っています)

とした中で、

以下のパッケージが更新されます:          
  elasticsearch 

と、elasticsearchを含むアップデートがあったときの注意点です。

注意1:設定ファイルの維持

(データベースを読み込んでいます ... 現在 170063 個のファイルとディレクトリがインストールされています。)
.../elasticsearch_9.2.0_amd64.deb を展開する準備をしています ...
elasticsearch (9.2.0) で (9.1.5 に) 上書き展開しています ...
elasticsearch (9.2.0) を設定しています ...

設定ファイル '/etc/elasticsearch/jvm.options'
 ==> これはインストールしてから (あなたかスクリプトによって) 変更されています。
 ==> パッケージ配布元が更新版を提供しています。
   どうしますか? 以下の選択肢があります:
    Y か I  : パッケージメンテナのバージョンをインストールする
    N か O  : 現在インストールされている自分のバージョンを残す
      D     : 両バージョンの差異を表示する
      Z     : 状況を調査するためにシェルを開始する
 デフォルトでは現在使っている自分のバージョンを残します。
*** jvm.options (Y/I/N/O/D/Z) [デフォルト=N] ? 

の質問が来た場合、N を確実に選んでください。手なりでのyは厳禁です。なぜなら、Growi設定時に

-Xms256m
-Xmx256m

の2行を追記しているからです。(※数値は環境によって異なりますが、Growi推奨値が256MBです)

この -Xms256m および -Xmx256m の2行は、Elasticsearch の JVMヒープメモリの初期サイズ(Xms)と最大サイズ(Xmx) を指定しています。これが削除される、つまりデフォルト設定に戻ると、Growi の安定性やパフォーマンスに以下のリスクがあります。

削除された場合のリスク

  1. メモリ不足によるクラッシュ
  • デフォルトではJVMが自動でヒープサイズを決定しますが、サーバのメモリ量や他プロセスの使用状況によっては、必要なメモリが確保されず、ElasticsearchがOutOfMemoryErrorで落ちる可能性があります。
  1. パフォーマンスの低下
  • 初期サイズが小さいと、ヒープの拡張が頻繁に発生し、GC(ガベージコレクション)による停止時間が増加します。これにより、Growiの検索やデータ取得が遅くなることがあります。

間違えてY/Iを選択してしまったら?

/etc/elasticsearch/jvm.options.dpkg-old

または

/etc/elasticsearch/jvm.options.dpkg-dist

にオリジナルが残されています。

sudo cp -pi /etc/elasticsearch/jvm.options.dpkg-old /etc/elasticsearch/jvm.options

または

sudo cp -pi /etc/elasticsearch/jvm.options.dpkg-dist /etc/elasticsearch/jvm.options

として復旧させましょう。

注意2:Growi依存プラグインによるサービス起動不可

そうして、アップデートが完了後、

Restarting services...
 systemctl restart elasticsearch.service
Warning: The unit file, source configuration file or drop-ins of elasticsearch.service changed on disk. Run 'systemctl daemon-reload' to reload units.


Job for elasticsearch.service failed because the control process exited with error code.
See "systemctl status elasticsearch.service" and "journalctl -xeu elasticsearch.service" for details.


systemctl status elasticsearch.service
failed (Result: exit-code)

と、failed (Result: exit-code)が出てサービスの再起動に失敗することがあります。この場合、Growiの全文検索は使うことができません。

原因:Growi固有のプラグイン

Growiインストール時、Elasticsearch用の

  • analysis-icu
  • analysis-kuromoji

のプラグインをインストールしています。これはパッケージと同時にアップグレードされません。Elasticsearchのコマンドで導入したパッケージのためです。

対処:再インストール

  • パッケージアンインストール
sudo /usr/share/elasticsearch/bin/elasticsearch-plugin remove analysis-icu
sudo /usr/share/elasticsearch/bin/elasticsearch-plugin remove analysis-kuromoji
  • パッケージ再インストール
sudo /usr/share/elasticsearch/bin/elasticsearch-plugin install analysis-icu
sudo /usr/share/elasticsearch/bin/elasticsearch-plugin install analysis-kuromoji

2つの注意点を対処後

まず、Run 'systemctl daemon-reload'と言われているので、

sudo systemctl daemon-reload

で更新されたデーモン設定ファイルを読み込みます。

次いで、

systemctl status elasticsearch.service

で、Elasticsearchが依然としてfailed (Result: exit-code)となっていることを確認。その後、

sudo systemctl restart elasticsearch.service

としてサービスを再起動。今度はエラーが起きないと思います。

systemctl status elasticsearch.service

でもactive/runningを確認しましょう。

Growi上での最終確認

  1. Growiに管理者権限でアクセスします。
  2. 設定>全文検索管理に進みます。

接続の状態 接続されていますと表示されていることを確認し、

トップページに戻って検索を開始。想定通りの検索結果が出れば対処完了です。

RedmineViewCustomizeプラグインを利用して、ナレッジベースのキャッチ画像を別画面で出す。

プロジェクトのナレッジベースプラグインのアイキャッチをクリックした際、添付画像に直接飛ぶView Customizeの設定です。

ここの画像をクリックすることで、

この添付ファイル画像へと飛びます。

前提

  • ReddmineにViewCustomizeプラグインがはいっていること。
  • これを触ることができる権限を持っていること。
  • knowledgebaseプラグインが入っていること。

ViewCustomizeで新たな表示設定を追加

  1. Redmineに管理者権限でログインします。
  2. 管理>表示のカスタマイズへ進みます。

以下のようにして新しい表示を追加します。

  • パスのパターン
    • /projects/[^/]+/knowledgebase/articlesと、ナレッジベースの機器一覧を設定
  • プロジェクトパターン
    • 空白
  • 挿入ページ
    • 全ページのヘッダ
  • 種別
    • JavaScript
  • コード

以下のように入力。

$(function() {
  // Knowledgebase記事一覧内のサムネイルのコンテナを対象とする
  $('.article-list-thumbnail').each(function() {
    var $container = $(this);
    var $img = $container.find('img');
    var originalSrc = $img.attr('src');

    // サムネイルのURLをフルサイズ画像のURLに変換
    // 例: /attachments/thumbnail/946  ->  /attachments/946
    if (originalSrc && originalSrc.includes('/attachments/thumbnail/')) {
      var fullSizeSrc = originalSrc.replace('/attachments/thumbnail/', '/attachments/');

      // <a>タグを作成し、サムネイル画像を囲む
      var $link = $('<a>')
        .attr('href', fullSizeSrc)
        .attr('target', '_blank') // 新しいタブで開く
        .addClass('knowledgebase-zoom-link'); // 独自のクラスを追加 (後でLightboxプラグインと連携する際などに便利)

      // 画像をリンクで置き換える
      $img.wrap($link);

      // (オプション) カーソルをポインターに変更し、クリック可能であることを示す
      $img.css('cursor', 'pointer');
    }
  });
});
  • コメント
    • knowlegebaseのアイコンをクリック時に添付を表示するなど

これを有効にして保存。

設定確認

設定したRedmineサイトの任意のナレッジベースにアクセス。
上記のように、一覧の画像をクリックして添付ファイルが開けば設定完了です。

ユースケース: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には最初にテキスト形式で

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

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

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

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

iPhone AIR、撮影の試し撮り。

早速、新しいiPhoneで撮影をいくつか試しました。

フィギュア

良くも悪くもスマートフォンのカメラ。ぼけ感は普通には出なかったですが、詳細なパンフォーカスは役立ちます。

景色

近景は強いです。影も潰れず、光のあるところと無いところをかき分けている感じです。

食べ物

食べ物の強さは変わらず。見たとおりの色が出ていました。

マクロ

これは長年使っていたiPhone11の方がよかったかもという疑問点。

前のマクロがよかっただけに、慣れるのに時間がかかりそうです。

ユースケース: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つの力が合わさったという形です。

おまけ

更に

  • 表情
  • 小物
  • 季節感

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

Page 1 of 16

Powered by WordPress & Theme by Anders Norén