Aspect Ratio selector で 画像サイズ調整がお手軽に!
こんにちは。あるいは、こんばんは!
Stable Diffusion WebUI の画像生成をする際に、便利な拡張機能がたくさんあると思います。
とりわけ、ライターさんにとって、ブログやSNSサイトに画像を挿入する際に「サイズ」や「アスペクト比」が決まっていることも多いのではないでしょうか。
Stable Diffusion WebUIで画像生成されている場合には(まだSD人口多くない?)、スライダーや数値入力でちまちま設定することが(下図)、ワンクリックボタンポチッで設定できるようになるので、さぞかし便利になるのではないでしょうか!わたしは、そうしたいです。
では、やってみます!
Stable Diffusion WebUI起動
わたしの環境では、以前の記事で作成したバッチファイル(py310.bat)で、Anaconda仮想環境py310から起動するようにしています。
py310.batをダブルクリック
chcp 65001
call C:/Users/user/Anaconda3/Scripts/activate.bat
call activate py310
cd C:/Users/user/Dropbox/GitHub/clone/stable-diffusion-webui
C:/Users/user/.conda/envs/py310/python.exe launch.py --skip-python-version-check
pause
コマンドプロンプトやターミナルから
以下を1行ずつ入力して、実行していきます!
conda activate py310
cd /Users/user/Dropbox/GitHub/clone/stable-diffusion-webui
python launch.py --skip-python-version-check
ちなみに、わたしはVisual Studio Codeというソフトを使用しています。
Aspect Ratio selectorをインストールするよ!
Stable Diffusion WebUIが立ち上がったら、拡張機能を確認してみましょう。
Aspect Ratio selectorは、Stable Diffusion WebUIの拡張ツールの一つです。
エラーを吐きやがり お戻しになりました!
いつものことです。。。
この場合は落ち着いて、コマンドプロンプトから以下のように入力するか、GitHubからフォルダをダウンロードしましょう!
cd /Users/user/Dropbox/GitHub/clone/stable-diffusion-webui/extensions
git clone https://github.com/alemelis/sd-webui-ar.git
Aspect Ratio selectorを使ってみよう!
①「txt2txt」「txt2img」タブにボタンが出るようになります。
②「Calc」ボタンを押すと、
③計算器(Aspect Ratio Calculator)が展開します。
上段はアスペクト比で、設定されたHeightの値に対して、Widthの値を変更してくれます。
(「1:1」のときにHeightの値が変更されるという現象を確認しています)
下段は固定値で、デフォルトでは以下のように設定されています。
設定ファイル(aspect_ratios.txt、resolutions.txt)には以下の情報が入っているようです。
noteで使用する画像のサイズ
noteで使用する画像をSDで生成させる場合に、あらかじめサイズを登録しておくとよいですね♪
以下にresolutions.txtフォーマットでメモしておきます。
※日本語は使用しないほうが良いようです!
PIXIV FANBOXで使用する画像のサイズ
まとめ
サイズを1ボタンで簡単にセッティングできるのはありがたいことですね!
スライドや数値入力の手間が省けます。
些細なことではありますが、同じフォーマットで複数のSNSサイトなどを抱えてらっしゃる方には重宝されるのではないでしょうか。
他にもたくさんの拡張機能がありますが、note書きながらお試しするのはとても時間がかかりますね(-o-;)
なかなかやりたいことにたどり着けませんが、ヘッダーを1ポチするだけで作成できるようになったのは収穫です♪
他にも拡張機能を試しながら、プロンプトの開発を手掛けたいものです。
この記事が参加している募集
この記事が気に入ったらサポートをしてみませんか?