私的AI研究会 > ComfyUI11

画像生成AI「ComfyUI」11(実践編Ⅱ)

 「ComfyUI」を使ってローカル環境でのAI画像生成を検証する

▲ 目 次
※ 最終更新:2026/04/12 
 『FLUX.1』『FLUX.2』を検証する

プロジェクトで作成するワークフロー

このプロジェクトで作成するワークフローと関連データは下記にアップロードしている(更新されている場合は再度ダウンロードのこと)
 

『FLUX.1』「schnell(シュネル)」を検証する

 『FLUX.1』の軽量モデル「schnell(シュネル)」を検証する

概要

  1. モデルのダウンロードと配置
    モデル名ファイル名(.safetensors)配置先ダウンロード URL
    FLUX.1「schnell」flux1-schnell-fp8/StabilityMatrix/Data/
    Models/
    diffusion_models/https://huggingface.co/Comfy-Org/flux1-schnell/blob/main/flux1-schnell-fp8.safetensors
    text_encoderst5xxl_fp8_e4m3fntext_encoders/https://huggingface.co/comfyanonymous/flux_text_encoders/tree/main
    vaeaeVAE/https://huggingface.co/lovis93/testllm/blob/ed9cf1af7465cebca4649157f118e331cf2a084f/ae.safetensors
    ControlNetFLUX.1-dev-ControlNet-Union-Pro-2.0ControlNet/https://huggingface.co/Shakker-Labs/FLUX.1-dev-ControlNet-Union-Pro-2.0/tree/main
    FLUX.1-dev-ControlNet-Union-Pro-2.0-fp8https://huggingface.co/ABDALLALSWAITI/FLUX.1-dev-ControlNet-Union-Pro-2.0-fp8

Step 1:標準テンプレートによる生成

  1. ワークフローを選ぶ

    ① 左の画像または下記からダウンロードする
     ・ComfyUI_examples/flux/flux_schnell_example.png
    ② キャンバスへドラッグ&ドロップ
    ③ モデル / VAE / テキスト・エンコーダを設定したものに変更する ④ ワークフローを整理して保存する

  2. ワークフローを実行する
    プロンプト
    a bottle with a beautiful rainbow galaxy inside it on top of a wooden table in the middle of a modern kitchen beside a plate of vegetables and mushrooms and a wine glasse that contains a planet earth with a plate with a half eaten apple pie on it
    モダンなキッチンの真ん中にある木製のテーブルの上に、美しい虹の銀河が描かれたボトルがあり、その横には野菜とキノコの皿と地球が描かれたワイングラスがあり、その上には食べかけのアップルパイが乗った皿がある。
    ワークフロー:「FLUX/」file3111_flux1_schnell_simple.json
    comfyui_730_m.jpg

Step 2:コントロールネットで画像を制御する

  1. 『FLUX.1』「schnell(シュネル)」での ControlNet
    ・「SamplerCustumAdvanced」ノードで ControlNet のワークフローが見当たらないので、従来モデルの手法でアレンジして作成する
    ・正解かどうかは不明だがとりあえずは動作して生成画像ができる

  2. モデルのダウンロードと配置
    モデル名ファイル名(.safetensors)配置先ダウンロード URL
    ControlNetFLUX.1-dev-ControlNet-Union-Pro-2.0-fp8/StabilityMatrix/Data/
    Models/
    ControlNet/https://huggingface.co/ABDALLALSWAITI/FLUX.1-dev-ControlNet-Union-Pro-2.0-fp8
  3. ワークフローを実行する
    プロンプト
    Close-up portrait of a Japanease young woman in her 20s, natural makeup, soft expression.
    85mm lens, f/1.4, shallow depth of field, bokeh background.
    Soft window light from the left, golden hour glow, warm skin tones.
    Cinematic, realistic, high detail, professional photography.
    NOT: oversaturated, anime style, low resolution, distorted face.
    20代の日本の若い女性のクローズアップポートレート。ナチュラルメイク、柔らかな表情。
    85mmレンズ、f/1.4、浅い被写界深度、背景のボケ。
    左から差し込む柔らかな窓の光、ゴールデンアワーの輝き、温かみのある肌色。
    映画のような、リアルな、細部までこだわった、プロフェッショナルな写真。
    注意点:彩度過度、アニメ調、低解像度、歪んだ顔。
    ワークフロー:「z_image/」file3112_flux1_schnell_controlnet.json入力画像ControlNet なし
    comfyui_749_m.jpg portrait_02_m.jpg 3112_2026-03-19_00001_m.jpg

 

『FLUX.2』「klein(クライン)」を検証する

 『FLUX.2』の超高速・軽量モデル「klein(クライン)」を検証する

概要

  1. モデルのダウンロードと配置
    モデル名ファイル名(.safetensors)配置先ダウンロード URL
    FLUX.2「klein」
    (distilled 蒸留版)
    -flux-2-klein-4b/StabilityMatrix/Data/
    Models/
    diffusion_models/https://huggingface.co/black-forest-labs/FLUX.2-klein-4B/blob/main/flux-2-klein-4b.safetensors
    fp8flux-2-klein-4b-fp8https://huggingface.co/black-forest-labs/FLUX.2-klein-4b-fp8
    nvfp4flux-2-klein-4b-nvfp4https://huggingface.co/black-forest-labs/FLUX.2-klein-4b-nvfp4
    FLUX.2「klein」
    (base版)
    -flux-2-klein-base-4bhttps://huggingface.co/black-forest-labs/FLUX.2-klein-base-4B/tree/main
    fp8flux-2-klein-base-4b-fp8https://huggingface.co/black-forest-labs/FLUX.2-klein-base-4b-fp8
    nvfp4flux-2-klein-base-4b-nvfp4https://huggingface.co/black-forest-labs/FLUX.2-klein-base-4b-nvfp4
    text_encodersqwen_3_4b_fp4_mixedtext_encoders/https://huggingface.co/Comfy-Org/z_image_turbo/tree/main/split_files/text_encoders
    vaeflux2-vaeVAE/https://huggingface.co/Comfy-Org/flux2-dev/resolve/main/split_files/vae/flux2-vae.safetensors
  2. 量子化モデルの違い
    distilled 蒸留版base版
    -fp8nvfp4-fp8nvfp4
    モデル名
    (.savtensors)
    flux-2-klein-4bflux-2-klein-4b-fp8flux-2-klein-4b-nvfp4flux-2-klein-base-4bflux-2-klein-base-4b-fp8flux-2-klein-base-4b-nvfp4
    サイズ (GB)7.213.792.297.213.802.31
    生成画像 3121_fp16_m.jpg 3121_fp8_m.jpg 3121_nvfp4_m.jpg 3122_fp16_m.jpg 3122_fp8_m.jpg 3122_nvfp4_m.jpg
    生成時間
    (分:秒)
    distilled 蒸留版base版
    -fp8nvfp4-fp8nvfp4
    GPURTX-407000:11.2800:05.8200:05.0300:29.3500:18.6400:23.32
    RTX-406000:36.5000:07.5900:14.6501:27.5000:51.9601:00.08
    RTX-4060L01:03.0900:21.5900:15.8701:48.4101:01.8101:13.79
    RTX-305002:15.6601:13.0200:52.0503:55.8702:50.1102:28.33
    GTX-105002:17.6101:57.5501:59.8718:12.5018:09.7318:40.80
    CPUi7-1260P09:40.7209:13.2909:29.2084:28.84102:41.80121:37.23
  3. 「fp8」モデルを選択する理由
    ・通常モデルよりサイズが小さい(およそ半分)
    ・速度が倍近く早い
    ・「nvfp4」モデルは GPU によっては高速になるがハードウェアに存性が高い
    ・CPU 環境でも動作する
    ・通常版に比べ画像品質(特に文字表現)は若干低下する

Step 1:標準テンプレートによる生成

  1. ワークフローを選ぶ

    ① 左端のメニューから「Template」を選択
    ② 検索欄に「FLUX2」を入力する
    ③「Flux.2[klein] Text to Image」を選ぶ
    ④ アラートダイアログが出るが無視して閉じる
    ⑤「clip_name」に「qwen_3_4b_fp4_mixed.safetensors」を指定する(上下 2 か所)
    ⑥ 上側「unet_name」に「flux-2-klein-base-4b.safetensors」を指定する
    ⑦ 下側「unet_name」に「flux-2-klein-4b.safetensors」を指定する
    ⑧「vae_name」に「flux2-vae.safetensors」を指定する(上下 2 か所)

  2. ワークフローを実行する
    ワークフロー:image_flux2_klein_text_to_image.jsondistilled 蒸留版base版
    comfyui_742_m.jpg Flux2-Klein_00002_m.jpg Flux2-Klein-base_00002_m.jpg
    ※ このワークフローは 蒸留版(下側) / base版(上側) 2つのモデルに対応する。いずれかを有効にして実行する

  3. ワークフローを整理する
    プロンプト
    A hedgehog wearing a tiny party hat surrounded by confetti, early digital camera style, slight noise, flash photography, candid moment, 2000s digicam aesthetic, festive birthday celebration atmosphere A vintage motorcycle parked in front of a retro diner at sunset, warm orange and pink sky, neon signs glowing, 80s vintage photo style, film grain, warm color cast
    紙吹雪に囲まれた小さなパーティーハットをかぶったハリネズミ、初期のデジタルカメラスタイル、わずかなノイズ、フラッシュ撮影、自然な瞬間、2000年代のデジカメの美学、お祭り気分の誕生日のお祝い夕暮れ時、レトロなダイナーの前に停められたビンテージバイク、温かみのあるオレンジとピンクの空、ネオンサインが光る、80年代風のビンテージ写真スタイル、フィルムグレイン、温かみのある色調
    ワークフロー (distilled 蒸留版):「FLUX/」file3211_flux2_klein_distilled.jsonワークフロー (base版):「FLUX/」file3311_flux2_klein_base.json
    comfyui_743_m.jpg comfyui_744_m.jpg

Step 2:参照画像による生成1(distilled 蒸留版)

  1. テンプレート・ライブラリからワークフローを選ぶ

    ① 左端のメニューから「Template」を選択
    ② 検索欄に「FLUX2」を入力する
    ③「Flux.2[klein] 4B Distilled:Image Edit」を選ぶ

    ・ワークフローで使われている画像データのダウンロード先
     → GitHub: ComfyUI-Org workflow_templates
    ワークフロー:image_flux2_klein_image_edit_4b_distilled.json入力画像
    comfyui_751_m.jpg handbag_white_m.jpg comfy_logo_blue_m.jpg
    ワークフローの修正点問題点と対策
    ① モデル「quen_3_4b.safetensors」がない
     →「qwen_3_4b_fp4_mixed.safetensors」
    ② バイパスしているノードを有効化する
    ③ 上側のノードのプロンプトが適当でないので変更
     → Please change the bag color to bright red.
    ④「Run」を押して実行する( ← 結果)
    ・ワークフローを保存して読み込むと一部の接続が切れる
    ・「SubGraph」機能の問題のようなので、展開したワークフローを作成する
    ・参照画像が 1枚・2枚の場合を分けたワークフローにしてノードを整理する



  2. ワークフローを整理する
    プロンプト
    Please change the bag color to bright red. stylize the handbag in image1 with the colours and logo from image 2
    バッグの色を鮮やかな赤色に変更してください。画像1のハンドバッグを、画像2の色とロゴでスタイリッシュにアレンジしてください。
    ワークフロー (蒸留版):「FLUX/」file3230_flux2_klein_image_edit_distilled.jsonワークフロー (蒸留版):「FLUX/」file3231_flux2_klein_image_edit_distilled.json
    comfyui_752_m.jpg comfyui_753_m.jpg
    3230_2026-03-21_00001_m.jpg 3231_2026-03-21_00001_m.jpg
  3. 生成例1:画像の視点を変える
    入力画像プロンプト生成画像
    car_interior_white_m.jpg Change the camera angle to a first-person driver's perspective looking through the steering wheel at the dashboard and windshield, maintaining the same white minimalist interior style and lighting 3230_2026-03-20_00002_m.jpg
    カメラアングルを、ステアリングホイール越しにダッシュボードとフロントガラスを見る一人称ドライバー視点に変更し、同じ白を基調としたミニマルなインテリアスタイルと照明を維持する。
  4. 生成例2:対象物にロゴをはめ込む
    入力画像1入力画像2 / プロンプト生成画像
    car_interior_white_m.jpg comfy_logo_blue_m.jpg 3231_2026-03-20_00002_m.jpg
    Apply the yellow "C" logo to the center hub of the steering wheel, and change the steering wheel color to royal blue matching the logo background, while maintaining the same interior style, lighting, camera angle, and all other elements unchanged
    ステアリングホイールの中央ハブに黄色の「C」ロゴを適用し、ステアリングホイールの色をロゴの背景に合わせたロイヤルブルーに変更します。インテリアスタイル、照明、カメラアングル、その他の要素はすべて変更せずに維持します。

Step 3:参照画像による生成2(base版)

  1. テンプレート・ライブラリからワークフローを選ぶ

    ① 左端のメニューから「Template」を選択
    ② 検索欄に「FLUX2」を入力する
    ③「Flux.2[klein] 4B Image Edit」を選ぶ

    ・ワークフローで使われている画像データのダウンロード先
     → GitHub: ComfyUI-Org workflow_templates
    ワークフロー:image_flux2_klein_image_edit_4b_base.json入力画像
    comfyui_761_m.jpg robed_women_m.jpg pink_tone_chair_m.jpg
    ワークフローの修正点問題点と対策
    ① モデル「quen_3_4b.safetensors」がない
     →「qwen_3_4b_fp4_mixed.safetensors」
    ② バイパスしているノードを有効化する
    ③「Run」を押して実行する( ← 結果)
    ・ワークフローを保存して読み込むと一部の接続が切れる
    ・「SubGraph」機能の問題のようなので、展開したワークフローを作成する
    ・参照画像が 1枚・2枚の場合を分けたワークフローにしてノードを整理する

  2. ワークフローを整理する
    プロンプト
    Change the background to a cozy, softly lit interior space with warm beige tones, soft natural window light filtering through, and a relaxed, intimate atmosphere similar to the original image's mood. Keep the person in the exact same position, scale, and pose. Maintain identical camera angle, framing, and perspective. The lighting should be soft, even, and warm - not harsh or bright. Only replace the room environment, preserving all facial features, hairstyle, expression, clothing, and pose exactly as they are. A stylish young woman with dark skin wearing a plush deep emerald green bathrobe, light pink towel turban, and red heart-shaped sunglasses, seated on a light-colored rattan chair with soft pink cushions, positioned in front of a textured dusty rose pink wall with an arched alcove, large tropical plants with broad dark green leaves framing both sides, woven straw baskets on the floor, remove any existing shoes from the background, only the woman's beige woven sandals visible in the foreground, soft natural lighting casting gentle shadows, warm bohemian chic aesthetic, professional fashion photography
    背景を、温かみのあるベージュトーンで、柔らかな自然光が差し込む、リラックスした親密な雰囲気の、居心地の良い室内空間に変更してください。これは、元の画像の雰囲気に似ています。人物の位置、サイズ、ポーズは元の写真と全く同じにしてください。カメラアングル、フレーミング、遠近法も元の写真と全く同じにしてください。照明は柔らかく、均一で、温かみのあるものにしてください。強すぎたり明るすぎたりしないようにしてください。部屋の環境だけを変更し、顔の特徴、髪型、表情、服装、ポーズはすべて元の写真と全く同じにしてください。濃いエメラルドグリーンの豪華なバスローブ、淡いピンクのタオルターバン、赤いハート型のサングラスを身に着けた、肌の黒いスタイリッシュな若い女性が、柔らかなピンクのクッションが置かれた淡い色の籐椅子に座っている。椅子の前には、アーチ型のくぼみのある、質感のあるダスティローズピンクの壁があり、両側には幅広の濃い緑の葉を持つ大きな熱帯植物が植えられている。床には編み込みの麦わらかごが置かれている。背景にある靴はすべて取り除かれ、前景には女性のベージュの編み込みサンダルだけが見える。柔らかな自然光が優しい影を落とし、温かみのあるボヘミアンシックな美学が感じられる。プロのファッション写真。
    ワークフロー (base版):「FLUX/」file3330_flux2_klein_image_edit_base.jsonワークフロー (base版):「FLUX/」file3331_flux2_klein_image_edit_base.json
    comfyui_762_m.jpg comfyui_763_m.jpg
    3330_2026-03-21_00001_m.jpg 3331_2026-03-21_00001_m.jpg
  3. 生成例1:対象物にイラスト画像をはめ込む
    プロンプト
    Apply the design from Reference Image 1 onto objects in Reference Image 2.
    参照画像1のデザインを、参照画像2のオブジェクトに適用します。
    入力画像1入力画像2
    image_flux2_input_Illustration_m.jpg image_flux2_input_ref_image_m.jpg
  1. 生成例2:参照画像と同じポーズで生成
    プロンプト
    In the pose shown in the reference image
    Close-up portrait of a Japanease young woman in her 20s, natural makeup, soft expression. 85mm lens, f/1.4, shallow depth of field, bokeh background. Soft window light from the left, golden hour glow, warm skin tones. Cinematic, realistic, high detail, professional photography.
    参考画像に示されているポーズで撮影。
    20代の日本人女性のクローズアップポートレート。ナチュラルメイク、柔らかな表情。85mmレンズ、F1.4、浅い被写界深度、背景のボケ。左側からの柔らかな窓からの光、夕暮れ時の黄金色の輝き、温かみのある肌色。映画のようなリアルさ、高精細、プロフェッショナルな写真。
    入力画像生成画像
    portrait_02_m.jpg 3330_2026-03-21_00002_m

日本語プロンプトによる画像生成

 自然言語で日本語の理解力もあるようなので日本語プロンプトでの生成を試してみる
 

更新履歴

 

参考資料