Skip to content

Conversation

yankeguo
Copy link
Contributor

This node will create transparent paddings to existed image and generate correct mask.

Now, users can do outpaint in pipeline directly

截屏2023-03-23 03 13 48

@GrimblyGorn
Copy link

2023-03-22 15_46_39-ComfyUI
That 3rd image from the left has pretty harsh seams still. Seems about the same going from 12 steps to 26 steps too. I might play with things more and figure that out later. It could be my many other random things causing that too. This is very handy either way though. Thanks :)

@yankeguo
Copy link
Contributor Author

@GrimblyGorn I just did exactly what described here https://comfyanonymous.github.io/ComfyUI_examples/inpaint/#outpainting, create a expanded image and corresponding mask

@comfyanonymous
Copy link
Owner

The reason you get seams is probably because you are using euler, if you use a different sampler like ddim or sde it will work better.

The issue I have is that it doesn't seem to work if I expand both the top and right for example and I wonder if that problem can be eliminated if the mask isn't a straight line but a slightly wobbly line instead if you understand what I mean.

@yankeguo
Copy link
Contributor Author

@comfyanonymous I will try to add a parameter to allow border feathering

@yankeguo
Copy link
Contributor Author

@comfyanonymous I've tried with top and right expanded, it works fine with inpaiting models, just the edges are too sharp. May be we can just merge this for now, and improve later with more advanced features, such as feathering, even subject detection.

ComfyUI_00496_.png.zip

@GrimblyGorn
Copy link

GrimblyGorn commented Mar 23, 2023

Changing from euler does change the seams some, along with other settings affecting them some as well. That's it's own issue and is less concerning in my case than it running out of memory on larger images. Seemingly this node does fine for extending the images. I think the memory failure comes from the KSampler attempting to fill in and render such large images.

Possibly I will have to look into making an alternate Sampler node for doing these larger images in "chunks" somehow. Much like item 4 from my mega-wall discussion, which is speaking on TiledVAEs and MultiDiffusion. That seems about the only way I'll be able to achieve the larger sizes I was hoping for with my limited 4GB vram.

This node does still seem to be a useful addition to have though :)

@yankeguo
Copy link
Contributor Author

@comfyanonymous @GrimblyGorn I added a feathering parameter, and it really makes difference.

Orignal:

ComfyUI_00571_

Outpaint without feathering:

ComfyUI_00574_

Outpaint with feathering 180px:

ComfyUI_00573_

@GrimblyGorn
Copy link

@guoyk93 This is doing a much nicer job of blending the seams now. Thanks :)

@WASasquatch
Copy link
Contributor

WASasquatch commented Mar 24, 2023

I think a more competent way to add something like this is simply transposing onto a image blank / blank latent image. That way it's not bound to padding a input image, but you can add your image to any image at any size or location.

This seems like something that could be part of the vae decode/encode to just chain up jobs almost?

@yankeguo
Copy link
Contributor Author

@WASasquatch I think this is more straightforward and easy to comprehend for users. it support using different checkpoint / vae for original image and inpainting.

@yankeguo
Copy link
Contributor Author

@comfyanonymous fixed, now it won't feather edges not expanded

@WASasquatch
Copy link
Contributor

WASasquatch commented Mar 25, 2023

Another consideration is how much VRAM this uses scaling tensors as apposed to raster. Manipulating sizes and such as tensors is extreme overkill when not actually doing a task with them like upscaling/denoising/diffusion (that does these things). It's a serious resource waste, and just abusing cards. I'd imagine you'd have memories issues scaling tensors as apposed to encoding at scale. Not sure though.

Does seem like something a single CPU core
and megabytes of RAM should be doing in a second vs filling up gigabytes of VRAM for no real speed gains.

@comfyanonymous comfyanonymous merged commit d741e7a into comfyanonymous:master Mar 25, 2023
@WASasquatch
Copy link
Contributor

I added Image Padding to WAS Suite for my GPUs sanity, and those with low VRAM cards

https://github.com/WASasquatch/was-node-suite-comfyui/blob/main/WAS_Node_Suite.py#L532

mid-dev-media pushed a commit to mid-dev-media/ComfyUI that referenced this pull request Mar 16, 2024
christian-byrne added a commit to christian-byrne/ComfyUI that referenced this pull request Jul 8, 2025
Co-authored-by: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants