vladmandic / automatic

SD.Next: Advanced Implementation of Stable Diffusion and other Diffusion-based generative image models
https://github.com/vladmandic/automatic
GNU Affero General Public License v3.0
5.55k stars 409 forks source link

[Feature]: inpaint preprocessor #3056

Open Flooosee opened 5 months ago

Flooosee commented 5 months ago

Feature description

Can you implement the inpaint preprocessors ? They are quite usefull to do good fill (outpainting) while resizing. A bit lIke the photoshop outpaint. This is the only docs i've found, sorry if its not what you looking for :

The actual tool for outpainting is sadly not doing what this preprocessor is doing, just filling with coherent stuffs, without touching the current pic. Tell me if something is missing, it would be really appreciated if you manage to bring this in SDN :)

Version Platform Description

No response

vladmandic commented 5 months ago

as far as i understand, those are not really controlnet model preprocessors, they are just masking helpers - and sdnext already has those and more built-in (control module -> masking).

and not sure why you mention outpainting in this context? outpainting is different than inpainting.

Flooosee commented 5 months ago

Mh, that is a video where the preprocessor is used (link redirect on the good timecode) : https://youtu.be/wyDRHRuHbAU?t=410 For me he is doing outpainting, or maybe im wrong ? Is the tool you mentionned capable of doing this type of resizing ?

vladmandic commented 5 months ago

i've taken a quick look at video and i don't see any outpainting there. outpainting would be if i had 512x512 image and i want to make it 512x1024 by adding NEW content to left 256px and right of the original image. and yes, sdnext can do that as well.

what he's doing is simple img2img plus adding tile upscaling at the end of the video.

Flooosee commented 5 months ago

Not to offend but did we look the same video ? (Even his step 3 is named: "3. Outpaint using ControlNet", Haha). If we take a look a bit earlier you can see he generated a 768x768 pic, then in img2img he’s using the ControlNet inpaint_only+lama to Resize&Fill (so outpaint) to achieve a resolution of 1368x768. So yeah he’s adding new content to right and left. Also if you talking about the Outpaint feature in Image, yeah i’ve tested it, but it needs to have high denoising to get a proper image, and in return it’s changing the whole pic and not only the extra size, instead of this method who just accordingly of the og pic, adds new relative content on extras (maybe it’s possible to do the same with current tool, but i didn’t find out). So I may have misunderstood, but i don’t think so.

Here his workflow a bit sped up:

Waiting for your reply, thx for your time.

vladmandic commented 5 months ago

I must admit I skipped over that. i much rather prefer when ppl explain what they want to achieve than point to go-there-I-want-that.

Flooosee commented 5 months ago

Sorry, but i literally explain the goal on first message... The achievement is to add these controlnets preprocessors to create nice outpainting following along the current pic without modiying it but add the extras. The video was only to give you a context of use, because you asked me why i talk about outpaint, wathever. My ask is only to improve SDN about outpainting, because right now i can't see a good uses of outpainting, as far as i know. Maybe we can already do this kind of outpainting, then i would be glad to know the method, but if not, is it possible to add these, or even to improve the current outpaint tool ? (also the preprocessors are good for inpaint fixes)

Current Workflow:

Result: The output is 1368x768, but changed the whole pic. Expected result: The output is 1368x768, the main pic isnt modified (768x768 part), and extras on right and left are coherent from the content of main pic.

vladmandic commented 5 months ago

sorry i wasn't clear - you did explain it in the previous writeup. keeping this open, will need some work.