defuser

the Stable Diffusion Plugin for Photoshop and Krita


Project maintained by internationalTD Hosted on GitHub Pages — Theme by mattgraham

alt textalt text

current release: v0.0.2-alpha2
release date: 01.11.2022
A Plugin for Photoshop and Krita that can interface with AUTOMATIC1111s Stable Diffusion WebUI.
You will not need to switch to another WebUI or modify your existing installation in any way.

Changelog:

alpha2:
-Fix candidate for Krita showing an empty UI because of a bad request in the plugin

v0.0.2:
-Rewrote the UI renderer, it should not error anymore because users have different Extensions/Scripts installed to their WebUI

Features

Planned features:

Installation

In case you haven’t already, install AUTOMATIC1111s Stable Diffusion WebUI

Wait for it launch before you start Krita or Photoshop, or the plugin panel will be empty.

Krita

  1. Copy this url to your clipboard: https://internationaltd.github.io/defuser/build/defuser-pykrita.zip
  2. With Krita open, go to Tools - Scripts - Import Python Plugin from Web and paste the link
  3. Hit yes to activate, then restart Krita
  4. Open the docker from Settings - Dockers - Defuser and start proomting!

Photoshop

  1. Download the latest release
  2. Open the file. Creative Cloud should prompt you to install.
  3. Open C:\Windows\System32\drivers\etc\hosts in a text editor and add the line 127.0.0.1 localhost.tech this is a workaround for an Adobe Photoshop bug that prevents connections to localhost from plugins on some machines. Sorry!
  4. Open the Docker under Plugins - Defuser and start proomting!

Photoshop - Manual (alternative) install - thanks anon!

  1. Download the latest release
  2. Open the file as an archive in 7-zip/WinRAR/what have you, and extract the contents to %APPDATA%\Adobe\UXP\Plugins\External\defuser_0.0.2
  3. Open %APPDATA%\Adobe\UXP\PluginsInfo\v1\PS.json and

    this is .json format, so:

    • If you have other plugins installed add a comma before the ]} at the end of the file, then paste {"hostMinVersion":"22.0.0","name":"Defuser","path":"$localPlugins\\External\\defuser_0.0.2","pluginId":"defuser","status":"enabled","type":"uxp","versionString":"0.0.2"}
    • If you don’t, and had to create that file, paste the following: {"plugins":[{"hostMinVersion":"22.0.0","name":"Defuser","path":"$localPlugins\\External\\defuser_0.0.2","pluginId":"defuser","status":"enabled","type":"uxp","versionString":"0.0.2"}]}

Quick Test

To test the installation, we are going to create any size document, then an exactly 512x512 selection, and finally generate a txt2img output. Here is how to do that:

  1. Create a new document.
  2. Press the “Generate” button and follow instructions, if any.

Usage

Start the WebUI with webui_user.bat as usual and just open Krita or Photoshop to generate.

Defuser will take care of requirements automatically for you. For example, it creates selections and inpainting masks and it will switch to an appropriate tool.

txt2img:

Defuser will never stretch or crop generated images. This means that if you press generate when no selection is made, Defuser defaults to a 512x512 selection. If you want a different aspect ratio, make a rough selection and press generate to snap to the nearest increment quickly. You don’t need to waste time trying to be pixel-perfect yourself. This goes for the other modes as well.

img2img:

If you want to transfer styles (e.g. turn a pencil sketch into watercolor), you should run img2img “stacked”. Don’t try to achieve a perfect result in one run. Use results as further input. Decrease noise_scale with subsequent generations, or the end result will diverge too much from the original composition.

Inpainting:

After generation, the current mask is hidden. If you unhide the !sdmask layer, it will be reused. Result quality varies wildly based on the masked_content parameter. Experiment with different brush hardnesses and mask_blur settings.

Outpainting:

If your input image borders the canvas edge, your result might seem cropped. You need to move the resulting layer, or the canvas, to get the result into frame. This behavior will be improved in a future release.

Additional Tips:

  1. Generation settings are saved in the layers. Press any button marked ♻️ to copy the settings from the selected layer into your docker. This works for any tab, regardless of what tab you used to generate. The button at the top copies all settings, seed included!
  2. If you miss a feature from the WebUI, open a browser tab. You can swap models on that page and it will work the same inside Krita/Photoshop.
  3. All outputs are still saved as configured in the WebUI, i.e., output/txt2img-images for txt2img by default. This can be useful if you need the prompt from an old output but you renamed the layer/merged it with something else.