Mastering Image Outpainting in SDXL with Stable Diffusion & Automatic 1111

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
[Music] hey everyone welcome back to Alchemy with zero phase this is Eric I want to do a quick video on out painting with stable diffusion uh more specifically when dealing with images generated using sdxl models okay um some people been having some problems trying to get the outp painted area to blend properly with um the original area of the image they tend to get this uh line across the top or I mean you know where the two images or the two areas uh meet and this can be incredibly frustrating if you're not sure how to get rid of it or how to avoid it in the first place so what we're going to do is we're going to kind of revisit the out painting um uh workflows there's a couple that I use uh and we're uh going to start with the one that deals with um the uh control net okay so uh let's just dive into this and uh we need some images so let's uh let's figure this let's figure out what we want to do here I think I'm going to do just a garden scene you know maybe a pretty woman or something like that and then uh we'll go from there okay professional photography of a beautiful Russian woman sitting in a garden next to a fountain going just get a couple few prompts here four prompts maybe um not going to worry about label them labeling them we're not going to do anything else we're just going to hit that and get our prompts and we'll move on okay so we got our prompts let's go and just uh grab these see what they give us we're going to drop these into the prompt from file or textbox script I want these to be 16 by9 um you know actually no we're going to do these uh 4x5 I want something a little more portrait okay um not going to worry about doing aail or anything like that we're going to keep this quick uh not even going to use a negative prompt we're just going to hit generate on this and go from there okay we got our images so let's take a look at these um not bad she's sitting in the fountain that's very interesting that one's pretty good hands are a little funky but overall it's okay that one's really good I like that one except you got the Roses kind of we might imp paint that out if we use that one let's see that one is great I like that one we get the depth of field um she's not overly weird uh so we're just going to go with this one right here and we're going to extend it out left and right uh kind of show you what is involved with this okay so we're going to use that one there so first thing you want to do is we're going to send this over to image to image so so control net I think could do this here in the text image um but I'm going to be sending this over to image to image okay first thing we want to we got to clarify okay any time you are doing out painting or inpainting you got to use an inpainting model okay if you don't use that uh it's going to throw an error um if you try to do inpainting or the uh the second method of out painting that I'm going to show you using just a regular model you are going to get the seams and borders that are going to make it look like crap so we're going to switch this over to an end painting model um for the realistic stuff we're going to go go ahead and use uh the uh AO Zia photo um in painting model it's got the vae B baked into it there are some other ones I'm just going to use this one it seems to work well for what I want to do let that switch over so the other thing we need to do is we're going to have to decide what we want to see outside this so it's a garden uh we've already got the image of the of the girl in the image so we don't need that part of the prompt we can come back here and grab the original prompt or what we can do is yeah let's just grabb that bring this back over here paste this in here oh let's try that again huh my uh control C on my keyboard's a little funky when trying to copy that stuff okay so what we want to do is get rid of make sure we don't have anything yeah we just need to get rid of this first part okay well not the first part we're just going to uh get rid of the part that deals with the woman okay we don't just because it's already she's already in there we're not recreating her uh we want to focus on what's going to be on the outside okay again we're not going to use a negative prompt um actually no I apologize with when you're dealing now that we're switching back down to a a uh a 1.5 model it probably is more prudent to use a negative prompt in these uh I am going to turn it down though a little bit uh so I have an extension called negative prompt weight or npw if you look it up uh where you can kind of tell it how intense you want the negative prompt to be you can go pretty high you can go really low um I find that I when my prompts are set up right I don't necessarily need a super heavy negative prompt if any at all so we're just going to stick with a a low weighted negative prompt okay now we're going to go to control net and we're going to select we're going to enable it do pixel perfect we're going to come down here and select in paint okay we're going to select the in paint only llama um this so you can use in paint only in paint llama seems to do a little bit better at getting that edge Blended in I'm not going to say it's perfect I'm going to show you here in just a little bit and I'm going to show you how to fix it too um we're going to select control net is more important um and then let's see we need to select the image so uh I forgot we actually aren't going to be using this here so what we need to do is actually bring over the image see if we can find it here okay we're going to upload independent control image drop that in there that should give us another option right here so where we have just resize crop and resize resize and fill we want to select resize and fill Bill okay so what that means is when we change the um the dimensions of the image so here's the original Dimensions right here but we want to increase its width we want to add some stuff to the outer edges okay so we're actually and this out paint method only works in um one plane or the other so meaning horizontally or vertically uh one at a time you you can't do both at the same time so if I were to change eight the width to say 1024 and the height to 1,200 um it's going to have an issue with that so we're only going to be messing with the width and we're going to switch that up to 1,200 okay which means we're going to add approximately 200 pixels off to each side okay we are going to increase the sampling steps um when you are working with inpainting out painting you want to have a higher step rate it tends to blend the images better okay now uh the sampler because we're working with realistic we want to stick with the DPM Plus+ range of stuff you don't want to use uler that'll create too soft of a look I'm going to switch up to the newer DPM Plus+ 3 on SD cross and then for the dooy strength we want this to be fairly High okay somewhere between 895 you just somewhere in there we're going to put it 09 and see how that does all right so that's pretty much the setup right there okay I don't think we need to modify anything else we've changed the uh the width so we're telling it we want about 200 pixels additionally on each side we're giving it more sampling steps to work with to blend a little bit better the dooy strength we want High because we want it to create something new off to the sides okay um when you when you go high like this it gives it more freedom to be creative with that just think of it that way we're selecting in paint ino in paint only llama we are working with a 1.5 model uh so um I don't think they have a in paint model for the two 2.1 or even the sdxl yet I I'd have to go back and look I don't think they do okay so you just got to make sure that you're using a one .5 uh in paint model up here as your primary checkpoint and then uh resize and fill is important if you do crop and resize it's going to just mess with the image okay okay so let's go ahead and uh hit render on that and see what we get and I'll let it keep recording because I want you to see what this looks like as it renders it give it a second to initialize there we go now as this goes the in my experimentation and usage with this when you're dealing with images that have a lot of variety in the background and the scenery the the seam or that edge tends to blend a lot better okay if you're working with images that have uh let's say a very flat background like a sky like a blue sky um you're going to get something that uh you're going to see that edge a lot more okay not sure I like this it's it's putting some stuff in the foreground uh that's supposedly out of focus we're going to try that again we're going to render um two more and uh I don't think we need to adjust anything else so let's just try that I will pause it on this one okay so we got uh a couple variations here let bring this up so again putting stuff here that's slightly out of focus which means it's close to the C camera and that's fine it's a good effect when you're especially when you're dealing with photo realism okay um so what we're seeing here is this is again because we got a lot of activity going it's very difficult to actually see where the edge is okay but it is there um you can kind of see right along here there is a shift in in how it does and sometimes it'll put objects next to it with a seam to kind of hide that it's really interesting how it does that then we over here we got this water falling from somewhere not exactly sure where um which is fine again that's noise that maybe people wouldn't notice okay so let's take a look at the other one here okay this one let's see I'll switch back honestly I'm liking this one better but um this one's not bad and it has uh trying to decide which one I want to show this next technique on [Music] here yeah so this one you can see here this is where the line is right here okay all the way down I mean it's not super visible and it really depends on what you want but you can see it right here too it's right there all the way down okay so I'm going to show you a quick technique how to fix this using inpainting okay so what we're going to do is we're going to send this over to the inpainting tab so we get this and um we're gonna open this up and then shrink it down so we can see the whole thing okay and what we want to do is where that edge is right here we're going to just create a mask over it okay um we don't need to do the whole thing we just got to break it up okay we're going to give the AI a chance to um blend it as you know for lack of a better term okay so all we're trying to do is hide that we want to make it look more natural okay so what we're going to do is we're creating these masks and yes I'm doing both sides not just one side at a time okay we're and because we're working with a fairly HZ original image we're going to increase the mask blur so this is where how it blurs the edges of these masks with the original image okay that's what's going to get rid of that seam even when you're in painting okay we're going to leave it on whole picture original we're going to get rid of the batch size we only want to do one okay we're going to come down here we're going to disable the control net we don't need that anymore and for the D noise strength um for this what we're going to be doing here I don't want it to change things a lot I just need it to get rid of that seam so we're going to go down to 0 4 usually between 04 0.5 you can even go up to you know to 6 but I'm going to just put it at 0.5 that way it's it's keeping the original but it's it's changing it just enough to get rid of that seam okay so let's go ahead and do that and I think that's it we're just going to leave it at that we're going to hit render or generate okay so as you can see uh we did get a little bit of abnormality here we got leaves kind of hang in the in the middle um and I would probably blend this I don't you know this Stone here just does not match on this side that could be an issue of the fact that we're using a 1.5 model but um over here it did it just fine okay and it did blend that quite a bit better so we can do this again uh um in fact what I might do is come over here and just select this whole thing right here just see if we can get something different I may even increase the dooy strength to6 and here's the thing you can you know take it out a little bit add some Randomness to it you know in fact we're going to get rid of that that hang that leaf that's hanging in the midair there we're going to do that too okay and then uh let's generate that one more time this didn't take very long so I'm just going to let it sit won't pause the video okay as you can see it is blending that really nicely creating a variety there yes we're we're getting the waterfall there we're we're leaving that waterfall there over here it did a much better job uh of blending that stone in as you can see okay um I don't know what's up with this waterfall I think because I left the water there um it it took that as Contex you have to understand when you're doing in painting and out painting it looks at the surrounding area around what's in the image and takes that as context and to continue generating um one thing I'm going to show you and once you see this you're going to not be able to unsee it in other images AI has a hard time when you BCT and image with an object whether it's a person a tree or whatever so this person here is bisecting The Fountain area and as you can see the fountain on this side is a different height than the fountain on that side you know when dealing with AI images that you know if you don't get it on your first try with the original image just rerender it possibly till you get something that looks a little bit better you could try rendering this using in painting I think it's going to be a struggle to it's not worth it uh I'd almost say take this is the side I like I would probably take this side and rerender the top of this to see if you get something better because the front looks great front looks uh looks great with that so that worked out really well um it Blended in nicely so it it's kind of a two-step process you out paint using control net okay and then once you have your image if you have a seam don't try you don't need to render the whole thing just take it into in painting mask out that seam a little bit with a little bit of random mask um regenerate using the settings I just showed you and you'll get something that looks great this is awesome um obviously it's not a you know A Perfect Image you got the water over here but you get the idea that's the technique okay so we're going to move on to the next technique okay using um the out paint Mark 2 technique okay so we're going to go back to the image image uh we've already disabled control net okay and we're going to set this back down to the original image size so you can click this button right here this angle and it'll grab the uh resolution of the image that's in the panel here okay so it puts it back to the original image size we are going to increase this again to uh about 08 okay we're going to leave the sampling steps at 50 okay we're going to leave the inpainting model up here we're going to come down here we're going to select a script called out painting Mark 2 um they have a they have another one called Poor Man's out painting that's the original one when they came out with the out painting Mark 2 it works so much better it's it's it works good I'll just leave it at that um and uh so with when you're working with this script okay you can do all four edges and what it does is it starts on one side moves to the other then moves to the bottom then moves to the top okay kind of does it in sequence I would not recommend doing that because uh you're going to waste a lot of time if say you get through the first two and then the third one on the bottom it turns out to be crap and you have to start all over again so typically what I will do is I will do at the most left and right okay um if I'm really serious about an image I'll start on the left get that one right then move to the move to the right get that one right and then so on and so forth okay so what we're going to do is we're just going to do left first okay and I really want to get some extension out of this we're going to go all the way to 256 okay when working with an image that has just you know plants and Randomness like that you don't have to worry about that too much if you're working with people like you're you got somebody you got this character and they're kind of cut off on one side of the image you you you only want to start with like 64 at the most 128 okay because the AI will create a lot of extra stuff around that person and you're not going to get what you want you can try it but when you're dealing with Garden scenes nature organic stuff stuff that's just kind of random anyway going all the way to 256 is fine okay um with the mask blur I do increase this uh if I go to 2 256 sometimes I'll I'll go all the way to 64 now what this is going to do it's going to take 64 pixels into the original image and I like to think of it again as the AI using that is context okay if you shrink this down um to 32 or below 32 uh it doesn't have it's going to have this little tiny blurry Edge to work with so the AI doesn't have much information to work with and you're going to get more of a seam okay so the higher this number not always best again if you're dealing with characters you probably want to keep this down low 32 to 24 just so that the AI doesn't eat up your character especially if it's being cut off on one side okay we're going to put it up to 64 we're going to do the left side we don't need to mess with anything else okay just leave it like that um I think that's it let's go ahead and uh generate that okay that was pretty quick so this is interesting yeah we got uh definitely got some water Fage going on and this right here so this this uh looks like a The Fountain Bowl kind of spilling over I don't necessarily like that um what I'm going to do we're going to get rid of the cascading fountain because I don't want that in there okay and I also had a serenely seated so uh we're also going to get rid of this mesmerizing gaze okay oops all right we're going to try that again 50 steps let's increase the D noise to 85 and let's bring this down to 40 rerender that again it should be pretty quick because we're only working with one side Ah that's looking much better yeah I think I like that a lot better wow yeah that's that's really good I love this how we got this um kind of a depth of field going on with the continuation of a wall we have a pond over here it is interesting we still have water falling off of this what looks like a cherry blossom tree but it looks good I like it here's the thing I love using the out paint Mark I it handles edges so much better as you can see there's not really a seam there um the seam would be right here and as you can see it it it was able to complete this vase in the background and uh blend these two trees in or you know these two uh plants together and you start getting uh you know out of focus area off the site so that's great let's go ahead and move on to the next side so we take left off go to right we don't have to modify anything else we're just going to do generate let that go okay so the mistake I made here is that I forgot to send the new image that we just did over to uh the panel over here and so all I did was just create a new image with the right generated which it did a good job did a great job there's no seam on this I me you have this right here which you could it's not really a seam it's just how it's creating the objects gives it that edge it Blended much better than the control net method but I forgot to show you one thing so once you get the new image you like it we're going to send that back over to in painting okay sorry not in painting uh image to image okay there that way we have a new image we're working with it should automatically adjust the uh width and height here okay now we switch sides and we're going to have to go back to the left cuz uh I'm not going to go back to my image browser to grab the original one we got this one we're going to work with it I like these settings the setting seems to seem to work really well for this particular image so now we're just going to generate on that and extend that out again this time we should get an image that has the 256 on one side and 256 on this side we are going to get something different looks like this time with some uh depth of field on the cherry blossom trees coming towards the camera which is cool it made the vase a little bit bigger which I kind of like actually okay so there we go so we have this side and this side looks really good okay again you can use the same technique as we did on the um control L method if you don't like how something is going together um to where it makes it feel like there is kind of an edge there because the way of the way it puts the objects together which in this one I don't think it did I think it did a great job you can still use that masking method send it over to end paint mask out that edge just make it a little noisy and increase that noise or you know the the D noise strength up a little bit so that it puts some variety in there okay we're going to send this over to in paint okay I really liked how it did that call not in paint I apologize uh image image okay so we got that image in there now we're going to I'm going to do both sides at the same time I really want to throw this out there let's make this super wide and that's what's kind of cool about this one is you can just keep going I've made some images that are incredibly wide like uh um almost panoramic with this it does it one at a time again so it's going to start off on one side and then it'll go to the other side we're going to get a much denser variation on the uh cherry blossom branches and and leaves which is fine it is putting in a a uh water Watermark signature uh thing down here because we are using a 1.5 in painting model which that is just kind of a known thing not that it belongs to anybody it's just the AI it was trained on so many images ah had things like that it just thinks there should be an object there it's not that it's being it's identifying with any particular uh brand name or anything like that all right let's let that finish up and I'll show you how to get rid of that water mark I mean everybody here maybe I don't know knows how to inpaint out something like that if you don't like it it's really quick I'll just do that as kind of a little bonus on this image so there we go we got uh um it's trying to say Serenity and that's because we uh I think yeah because the very first word here Serenity In Bloom you know again you know my prom generator will throw in some weird words like that once in a while and the way it tries to interpret that the model tries to interpret that as as a word so anyway so we got that um I think this is great uh we got these out of focus stuff so we got this great depth of field focused on her draws your eyes towards her that's that's a good image oh we got some water marking down here too so let me show you how to get rid of those we're going to take this over to in paint this time let's see if it'll do it here yeah it's having a hard time with that image I'm not sure what's going on with it let's see if we can just grab the image from the output folder which would be in the image to image images and we want the really wide one there we go it's interesting I don't know why that doesn't work there I mean I don't have messed with this a whole lot since they did the 1.6.0 update but whatever okay so what we're going to do on this we're going to mask out this area we're going to mask out this area okay and Just for kicks we're going to throw one up here well I don't think we need to because these are far enough apart and the way I'm going to show you how to do this this is exactly what I would do anyway is typically I would mask out the area I don't want and then I just put a little mask up here in the upper corner reason for that is it defocuses the AI and and it looks at the whole image and just creates something that would represent the whole image I'm not sure if that makes sense I'll show you here uh in fact we'll do it one side at a time okay we're going to mask out this one first okay we're going to put a mask up here okay um for the mask blur uh yeah we're going to keep that at 12 we're going to do only masked okay we're going to set this to a 1 by one ratio we are going to turn this down because I know uh we don't need that we're going to do 768 by 768 okay this is the bounding box area that it's going to Encompass these two mask areas in okay if we just did this mask what it's going to do is create this bounding box around that area which brings it way zoomed in and the AI is going to put a lot of detail in there and it will probably even just recreate the the uh signature or the whatever it is the watermark okay that's why I put this little mask up here I may even have to go as far as over here but I don't think so I think we have a good enough area on this um sampling steps I think we're going to bring down to to 30 and I think everything else is fine um we don't need to mess around with too much on this oh we are going to get rid we have to disable the out paint on this okay I think we would throw an error for us if we were trying to do this on the inpaint tab so we got that disabled um just a review here real quick mask blurs at 12 we're using original only masked one by one area and uh leave everything else sayig scale 7 D strength 85 you can go you know down lower if you want but want a high I want to make sure we get rid of that signature okay and uh again we're using an in paint model for this cuz we're in painting hit generate give it a second to spool up and as you can see the bounding box is covering those two areas I pick areas that it's going to be okay that are just noisy background whatever you're not going to get a seam so as you can see it Blended that area in up there nice and we got rid of the signature we're going to do the same thing over here to get rid of that just to show you again real quick but we got to send this over to in ping let's see if it'll do it this time I think it did let's get rid of the Mask areas yeah so good it did it so now we mask out this area over here and let's just put this right there okay um actually you know what let's let's back that up one let's put it right I want it a little closer I think it'll still get rid of it but we're dealing with a more defined area with this this uh uh Fountain thing that's going on here so let's hit generate on that we don't have to change any other settings let that render out yeah looks like it's getting rid of it NOP no it brought in something else so again I I I was hoping by bringing the the second masked area a little closer we'd be able to well I don't know let's see it looks like it's putting a signature in there but uh again the preview area tends to be yeah see it put something else in there so we got to get rid of that second Mass let's just erase that going put that in there we're going to put this up um let's put it right where I originally was thinking I was going to put it generate on that oh you know what I was wondering why it was a little slower whenever you move an image from your output to over to the panel it automatically adjusts the width and height okay so you need to readjust go back down to 768 because we're working with a 1.5 model and it keeps it in that good range and that's probably why that signature or you know that that water mark was still there so but this should be fine we'll go ahead and generate that out should be a lot quicker this time it's not dealing with as much pixels you're probably wondering why it has this cuz it's a one by one area and I picked a pretty wide format so as you can see I got rid of it um didn't do anything bad up here we have no seams we had a great image and you could take this and start in painting certain areas get rid of these weird little uh waterfall looking things here the leaf that's right here you could try fixing this right here so it lines up with that anyway that's that's the technique those are the two techniques so when the with the first one just as a recap with the control net you're dealing with a two-step process get your out painted areas you're probably going to end up with some sort of a seam depending on the scene that you're working with remember just take it back into inpainting mask out that seam with a little bit of noise or random mask on both sides make sure you're doing whole picture um and increase your mask blur that'll help get rid of the inpaint seams completely okay and then generate and you should get rid of them okay uh like And subscribe leave some comments uh love getting requests this was a request from somebody on our Discord server I'll put a uh a link to in the Discord if you guys want to come in and see what we're doing we got a great Community going on and uh would love to hear from everybody we'll talk to you later
Info
Channel: AIchemy with Xerophayze
Views: 3,321
Rating: undefined out of 5
Keywords: Stable Diffusion, SDXL, Automatic 1111, Image Outpainting, Art Tutorial, Image Extension, Seamless Art, Creative Techniques, Artistic Workflow, SDXL Tips, Digital Art Mastery, Image Editing, Artistic Vision, AI Artistry, Visual Enhancement, Creative Process, Artistic Inspiration, Seamless Transitions, Digital Art, Visual Art, Art Creation
Id: 7KCj1BSxNyQ
Channel Id: undefined
Length: 34min 30sec (2070 seconds)
Published: Thu Nov 02 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.