StableDiffusion

LayerDiffusionの導入

 Stable Diffusion WebUI ForgeにLayerDiffusion機能をインストールすることで、透過画像を作ることができます。

LayerDiffusionのインストール

① Forgeを起動

 

②「Extensions」タブをクリック

 

③「Install from URL」タブをクリック

 

④「URL for extension's git repository」に

 

https://github.com/layerdiffusion/sd-forge-layerdiffuse

 

を入力して、クリック

 

⑤「Installed」タブをクリックして、

 

sd-forge-layerdiffuse

 

となっているか確認

 

   Apply and restart UI  タブをクリックして、再起動

 

以上で、LayerDiffuseの機能が使えるようになります。

LayerDiffuseの使い方

「txt2img」、「img2img」どちらでも使えます。

 

「Generation」にある

 

LayerDiffuse        ◀

 

「◀」をクリックすると、メニューが開きます。先ず、Enableにチェックを入れます。

 

LayerDiffuse        ▼
Enable
Method

Weight    Stop At
 

 

これで、LayerDiffuseが使えるようになります。

Method

Methodに表示されているのは、レイヤー画像生成用のモデルです。

モデルは、「models」の「layer_model」の中に自動的にインストールされます。

 

SD1.5用とSDXL用にそれぞれモデルが用意されています。使用するモデルのタイプに応じて、をクリックして候補から(SDXL)か(SD1.5)どちらかを選びます。

 

「Only Generate Transparent Image」で透過画像を作ることができます。

 

注意

デフォルトの画像保存場所には左側の市松模様の方しか保存されません。こちらはサンプル画像で、右側に表示される画像が透過PNG画像です。クリックして、適当なフォルダに保存します。

 

透明なグラス透過画像作成用グラス

 

※半透明なものでも、透過画像を作成できます。

 

画像の合成生成には、以下のモデルを使います。

 

(SD1.5)

 ・From Foreground to Background (need batch size 2) 

 ・From Background to Foreground (need batch size 2)

 ・Generate Everything Together (need batch size 3)

 (SDXL)

 ・Only Generate Transparent Image (Conv Injection)

 ・From Foreground to Blending

 ・From Foreground and Blending to Background

 ・From Background to Blending

 ・From Background and Blending to Foreground

 

追記(2025.8.25)

使用可能なバージョンハッシュ

 

Forge

29be1da7cf2b5dccfc70fbdd33eb35c56a31ffb7

LayerDiffusion

e4d5060e05c7b4337a3258bb03c4e3ad2f8b15bb