Image Generation
7 nodes
On this page 7
Add ControlNet
FunctionAdds a ControlNet to steer a picture: Generate Image, Transform Image or Inpaint Image follows its conditioning picture. Chain several to combine them, such as edges and depth.
AddControlNet -> Control Net Guide
controlNet: Control Net
image: Pixel Image
scale: Number
start: Number
end: Number
guessMode: Truth
control: Control Net GuideControlNetGuide AddControlNet(
ControlNet controlNet,
PixelImage image,
double scale = 0,
double start = 0,
double end = 1,
bool guessMode = false,
ControlNetGuide control)Parameters
| name | type | default | description |
|---|---|---|---|
| controlNet | Control Net | — | A ControlNet made for the generator's family, from Load ControlNet. |
| image | Pixel Image | — | The conditioning picture, already processed as the ControlNet expects (an edge map for a canny ControlNet, a depth map, a pose); Generate Image paints at its size, and Transform Image and Inpaint Image need it at their picture's. |
| scale | Number | 0 | How strongly it steers: 1 fully, less to loosen its hold; 0 for the pipeline's own (1 from text, 0.8 for img2img, 0.5 for Stable Diffusion inpainting, 1 for SDXL inpainting). SDXL ControlNets often want about 0.5. |
| start | Number | 0 | The share of the steps after which it starts to steer: 0 from the first step. |
| end | Number | 1 | The share of the steps after which it stops: 1 to the last step. |
| guessMode | Truth | False | Let the conditioning picture carry the content with little or no prompt; on for every ControlNet of the chain once any asks for it. |
| control | Control Net Guide | — | ControlNets already added, to combine with this one. |
Returns
| Control | Control Net Guide |
- Ships with
- Divooka Compute
- Graph kinds
- Flows Function Events Routine Constructs StateMachineState
- Declared by
- Image Generation
- Package
- Machine Learning
Finish With Refiner
FunctionFinishes an SDXL picture with SDXL's refiner: the base model paints the first part of the steps and hands its unfinished picture over, and the refiner paints the rest. Give it to Generate Image, Transform Image or Inpaint Image.
FinishWithRefiner -> Refiner Stage
refiner: Image Generator
handOverAt: Number
aestheticScore: Number
negativeAestheticScore: NumberRefinerStage FinishWithRefiner(
ImageGenerator refiner,
double handOverAt = 0.8,
double aestheticScore = 6,
double negativeAestheticScore = 2.5)Parameters
| name | type | default | description |
|---|---|---|---|
| refiner | Image Generator | — | The refiner, loaded by Load Image Generator from stabilityai/stable-diffusion-xl-refiner-1.0 on the base model's device and precision. |
| handOverAt | Number | 0.8 | The share of the steps the base model paints before handing over: 0.8 leaves the refiner the last fifth. |
| aestheticScore | Number | 6 | The aesthetic score the refiner aims for, on the scale of the LAION ratings it was trained on. |
| negativeAestheticScore | Number | 2.5 | The score it steers away from, when Guidance is above 1. |
Returns
| Refiner | Refiner Stage |
- Ships with
- Divooka Compute
- Graph kinds
- Flows Function Events Routine Constructs StateMachineState
- Declared by
- Image Generation
- Package
- Machine Learning
Generate Image
FunctionPaints a picture from a description, optionally following ControlNets and finished by SDXL's refiner.
GenerateImage -> Pixel Image
generator: Image Generator
prompt: Text
negativePrompt: Text
width: Integer
height: Integer
steps: Integer
guidance: Number
seed: Large Integer
scheduler: Diffusion Scheduler
control: Control Net Guide
refiner: Refiner StagePixelImage GenerateImage(
ImageGenerator generator,
string prompt,
string negativePrompt,
int width = 0,
int height = 0,
int steps = 0,
double guidance = -1,
long seed = 0,
DiffusionScheduler scheduler = DiffusionScheduler.Default,
ControlNetGuide control,
RefinerStage refiner)Parameters
| name | type | default | description |
|---|---|---|---|
| generator | Image Generator | — | An image generator. |
| prompt | Text | — | What the picture shows, such as "a lighthouse at dusk, oil painting". |
| negativePrompt | Text | — | What it should not show; used only when Guidance is above 1. |
| width | Integer | 0 | Its width in pixels, a multiple of 8; 0 for the model's own (512 for Stable Diffusion 1.5, 1024 for SDXL), or with Control the control picture's. |
| height | Integer | 0 | Its height in pixels, a multiple of 8; 0 for the model's own, or with Control the control picture's. |
| steps | Integer | 0 | How many denoising steps: 0 for the pipeline's own (50); 20 to 50 suit most models, 1 to 4 Turbo models. |
| guidance | Number | -1 | How closely it follows the prompt: below 0 for the pipeline's own (7.5 for Stable Diffusion, 5 for SDXL); 0 for Turbo models. |
| seed | Large Integer | 0 | The starting noise; the same seed and settings give the same picture. Negative for a different one each time. |
| scheduler | Diffusion Scheduler | Default | The denoising method. |
| control | Control Net Guide | — | ControlNets the picture follows, from Add ControlNet. |
| refiner | Refiner Stage | — | SDXL's refiner to finish the picture, from Finish With Refiner. |
Returns
| Image | Pixel Image |
- Ships with
- Divooka Compute
- Graph kinds
- Flows Function Events Routine Constructs StateMachineState
- Declared by
- Image Generation
- Package
- Machine Learning
Inpaint Image
FunctionRepaints the part of a picture a mask marks to match a description, and keeps the rest: inpainting, optionally following ControlNets and finished by SDXL's refiner. An inpainting checkpoint fills best; any other model repaints too.
InpaintImage -> Pixel Image
generator: Image Generator
image: Pixel Image
mask: Pixel Image
prompt: Text
negativePrompt: Text
strength: Number
steps: Integer
guidance: Number
seed: Large Integer
scheduler: Diffusion Scheduler
refiner: Refiner Stage
control: Control Net GuidePixelImage InpaintImage(
ImageGenerator generator,
PixelImage image,
PixelImage mask,
string prompt,
string negativePrompt,
double strength = 0,
int steps = 0,
double guidance = -1,
long seed = 0,
DiffusionScheduler scheduler = DiffusionScheduler.Default,
RefinerStage refiner,
ControlNetGuide control)Parameters
| name | type | default | description |
|---|---|---|---|
| generator | Image Generator | — | An image generator. |
| image | Pixel Image | — | The picture to repaint; the result is its size, whose sides must be multiples of 8. |
| mask | Pixel Image | — | White where to repaint and black where to keep, the picture's size; grey counts from half way. |
| prompt | Text | — | What the repainted part shows. |
| negativePrompt | Text | — | What it should not show; used only when Guidance is above 1. |
| strength | Number | 0 | How much of the masked part to change: 1 paints it afresh, less keeps more of what was there and runs that share of the steps; 0 for the pipeline's own (1 for Stable Diffusion, 0.9999 for SDXL). |
| steps | Integer | 0 | How many denoising steps the whole schedule has: 0 for the pipeline's own (50). |
| guidance | Number | -1 | How closely it follows the prompt: below 0 for the pipeline's own (7.5; 5 for SDXL with Control). |
| seed | Large Integer | 0 | The starting noise; the same seed and settings give the same picture. Negative for a different one each time. |
| scheduler | Diffusion Scheduler | Default | The denoising method. |
| refiner | Refiner Stage | — | SDXL's refiner to finish the repainted part, from Finish With Refiner. |
| control | Control Net Guide | — | ControlNets the repainted part follows, from Add ControlNet; their pictures are this picture's size. |
Returns
| Image | Pixel Image |
- Ships with
- Divooka Compute
- Graph kinds
- Flows Function Events Routine Constructs StateMachineState
- Declared by
- Image Generation
- Package
- Machine Learning
Load ControlNet
FunctionLoads a ControlNet, which makes a picture follow a conditioning picture such as an edge map, a depth map or a pose.
LoadControlNet -> Control Net
model: Text
device: Compute Device
precision: Precision
variant: TextControlNet LoadControlNet(
string model,
ComputeDevice device = ComputeDevice.Auto,
Precision precision = Precision.Auto,
string variant)Parameters
| name | type | default | description |
|---|---|---|---|
| model | Text | — | A repository id such as lllyasviel/control_v11p_sd15_canny for Stable Diffusion 1.5 or diffusers/controlnet-canny-sdxl-1.0-small for SDXL, or a folder with its config.json. |
| device | Compute Device | Auto | Where it runs: the generator's device. |
| precision | Precision | Auto | The number format of its weights: the generator's precision. |
| variant | Text | — | Which copy of the weights to download, such as fp16 for half-size files; empty for the full ones. |
Returns
| Model | Control Net |
- Ships with
- Divooka Compute
- Graph kinds
- Flows Function Events Routine Constructs StateMachineState
- Declared by
- Image Generation
- Package
- Machine Learning
Load Image Generator
FunctionLoads a Stable Diffusion or SDXL pipeline from a Hub repository or a folder in diffusers' layout, with LoRAs when given.
LoadImageGenerator -> Image Generator
model: Text
device: Compute Device
precision: Precision
variant: Text
loras: Text Array
loraWeights: Number ArrayImageGenerator LoadImageGenerator(
string model,
ComputeDevice device = ComputeDevice.Auto,
Precision precision = Precision.Auto,
string variant,
string[] loras,
double[] loraWeights)Parameters
| name | type | default | description |
|---|---|---|---|
| model | Text | — | A repository id such as stable-diffusion-v1-5/stable-diffusion-v1-5, stabilityai/sdxl-turbo, an inpainting checkpoint such as stable-diffusion-v1-5/stable-diffusion-inpainting or SDXL's refiner stabilityai/stable-diffusion-xl-refiner-1.0, or a folder with model_index.json. |
| device | Compute Device | Auto | Where it runs. A picture takes seconds on a GPU and minutes on a CPU. |
| precision | Precision | Auto | The number format of its weights; Auto is Float32 on the CPU and Float16 on the GPU. |
| variant | Text | — | Which copy of the weights to download, such as fp16 for half-size files; empty for the full ones. |
| loras | Text Array | — | LoRAs to apply: .safetensors files, folders or repository ids, in diffusers', PEFT's or kohya's layout. |
| loraWeights | Number Array | — | How strongly each LoRA applies, in the same order; 1 when not given. |
Returns
| Generator | Image Generator |
- Ships with
- Divooka Compute
- Graph kinds
- Flows Function Events Routine Constructs StateMachineState
- Declared by
- Image Generation
- Package
- Machine Learning
Transform Image
FunctionRepaints a picture to match a description, keeping its composition: img2img, optionally following ControlNets and finished by SDXL's refiner.
TransformImage -> Pixel Image
generator: Image Generator
image: Pixel Image
prompt: Text
negativePrompt: Text
strength: Number
steps: Integer
guidance: Number
seed: Large Integer
scheduler: Diffusion Scheduler
control: Control Net Guide
refiner: Refiner StagePixelImage TransformImage(
ImageGenerator generator,
PixelImage image,
string prompt,
string negativePrompt,
double strength = 0,
int steps = 0,
double guidance = -1,
long seed = 0,
DiffusionScheduler scheduler = DiffusionScheduler.Default,
ControlNetGuide control,
RefinerStage refiner)Parameters
| name | type | default | description |
|---|---|---|---|
| generator | Image Generator | — | An image generator. |
| image | Pixel Image | — | The picture to start from; the result is its size, whose sides must be multiples of 8. |
| prompt | Text | — | What the result shows. |
| negativePrompt | Text | — | What it should not show; used only when Guidance is above 1. |
| strength | Number | 0 | How much to change: 1 ignores the picture, less keeps more of it and runs that share of the steps; 0 for the pipeline's own (0.8 for Stable Diffusion; 0.3 for SDXL, 0.8 with Control). |
| steps | Integer | 0 | How many denoising steps the whole schedule has: 0 for the pipeline's own (50). |
| guidance | Number | -1 | How closely it follows the prompt: below 0 for the pipeline's own (7.5 for Stable Diffusion, 5 for SDXL); 0 for Turbo models. |
| seed | Large Integer | 0 | The added noise; the same seed and settings give the same picture. Negative for a different one each time. |
| scheduler | Diffusion Scheduler | Default | The denoising method. |
| control | Control Net Guide | — | ControlNets the picture follows, from Add ControlNet; their pictures are this picture's size. |
| refiner | Refiner Stage | — | SDXL's refiner to finish the picture, from Finish With Refiner; not together with Control. |
Returns
| Image | Pixel Image |
- Ships with
- Divooka Compute
- Graph kinds
- Flows Function Events Routine Constructs StateMachineState
- Declared by
- Image Generation
- Package
- Machine Learning