ComfyUI Extension: ComfyUI-DiffusersImageOutpaint
ComfyUI nodes for outpainting images with diffusers, based on a/diffusers-image-outpaint by fffiloni.
Custom Nodes (4)
README
ComfyUI nodes for outpainting images with diffusers, based on diffusers-image-outpaint by fffiloni.
Updates:
- 15/05/2025: Fixed
missing 'loaded_keys'
error. More details below. - 17/11/2024:
- Added more options to Pad Image node (resize image, custom resize image percentage, mask overlap percentage, overlap left/right/top/bottom).
- Side notes:
- Now images with round angles work, since the new editable mask covers them, like in the original huggingface space.
- You can use "mask" and "diffusers outpaint cnet image" outputs to preview mask and image.
- You can find in the same workflow file the workflow with the checkpoint-loader-simple node and another one with clip + vae loader nodes.
- 22/10/2024:
- Unet and Controlnet Models Loader using ComfYUI nodes canceled, since I can't find a way to load them properly; more info at the end.
- Guide to change model used.
- 20/10/2024: No more need to download tokenizers nor text encoders! Now comfyui clip loader works, and you can use your clip models. You can also use the Checkpoint Loader Simple node, to skip the clip selection part.
- 10/2024: You don't need any more the diffusers vae, and can use the extension in low vram mode using
sequential_cpu_offload
(also thanks to zmwv823) that pushes the vram usage from 8,3 gb down to 6 gb.
Installation
- Download this extension or
git clone
it in comfyui/custom_nodes, then (if comfyui-manager didn't already install the requirements or you have missing modules), from comfyui virtual env writecd your/path/to/this/extension
andpip install -r requirements.txt
. - Download a sdxl model (example) in comfyui/models/diffusion_models;
- Download a sdxl controlnet model (example) in comfyui/models/controlnet.
⚠ Choosing model and controlnet: As of now, I only tried RealVisXL_V5.0_Lightning
and controlnet-union-promax_sdxl
. Mixing RealVisXL with controlnet-union (non promax version) gave error, so it could be that other models/controlnets give error as well, but I haven't tried much combinations so I can't tell.
Flux is still beyond me (even if I was quite there, I think). I haven't tried integrating other model types, and after my flux failure I don't think I'll try adding other model types.
Since for now only sdxl models work, the configs are hardcoded.
</details>- (Dual) Clip Loader node: if you use the Clip Loader instead of Checkpoint Loader Simple, and want to use an
sdxl type
model like RealVisXL_V5.0_Lightning, you can downloadclip_I
andclip_g
from here. You can use this workflow (change model.fp16 withclip_g
).
Overview
- Minimum VRAM: 6 gb with 1280x720 image, rtx 3060, RealVisXL_V5.0_Lightning, sdxl-vae-fp16-fix, controlnet-union-sdxl-promax using
sequential_cpu_offload
, otherwise 8,3 gb; - ~As seen in this issue, images with square corners are required~.
The extension gives 5 nodes:
- Load Diffuser Model: a simple node to load diffusion
models
. You can download them from Huggingface (the extension doesn't download them automatically). Put them inside thediffusion_models
folder. It supports only unets; for whole checkpoints (unet+clip+vae) you can use the checkpoint loader simple by comfyanonimous; - Load Diffuser Controlnet: a simple node to load diffusion
models
. You can download them from Huggingface (the extension doesn't download them automatically). Put them inside thecontrolnet
folder; - Paid Image for Diffusers Outpaint: this node resizes the image based on the specified
width
andheight
, then resizes it again based on theresize_image
percentage, and if possible it will put the mask based on thealignment
specified, otherwise it will revert back to the default "middle"alignment
; - Encode Diffusers Outpaint Prompt: self explanatory. Works as
clip text encode (prompt)
, and specifies what to add to the image; - Diffusers Image Outpaint: This is the main node, that outpaints the image. Currently the generation process is based on fffiloni's one, so you can't reproduce a specific a specific outpaint, and the
seed
option you see is only used to update the UI and generate a new image. You can specify the amount ofsteps
to generate the image.
You can also pass image and mask to vae encode (for inpainting)
node, then pass the latent to a sampler
, but controlnets and ip-adapters won't always give good results like with diffusers outpaint, and they require a different workflow, not covered by this extension.
Missing 'loaded_keys' error
Recent versions of transformers
and diffusers
broke somethings, you need to revert back, command with some working versions (found here) (do it inside your comfyui env): pip install transformers==4.45.0 --upgrade diffusers==0.32.2 --upgrade
, or if you use the portable version, run this in ComfyUI_windows_portable -folder:
python_embeded\python.exe -m pip install transformers==4.45.0 --upgrade diffusers==0.32.2 --upgrade
.
Credits
diffusers-image-outpaint by fffiloni