Welcome to Kleebz Tech and another video in
our Fooocus for Stable Diffusion series. In this video, I'll go over the basics of
inpainting with Fooocus. Fooocus offers a straightforward and powerful inpainting
engine, which is particularly useful for regenerating parts of an image. This can
be handy for correcting imperfections, removing unwanted elements, or creatively altering
parts of an image. Often with AI image generation, you end up with images that are almost perfect
but have minor imperfections. Inpainting allows you to fix that image and or even add things to
those images without having to start from scratch. And don't forget, I do have plenty of other
videos covering Fooocus on how to install, basic usage, and I'll be creating more
videos in the future, so do check those out. So, let's get started on learning
how the inpainting works, the basics of it. I'm not going to
jump into all the advanced things; those will be future topics. I'll be doing
more videos on advanced inpainting techniques, but this will get you started with the basics and
get you experimenting and knowing how to use it. So, I've gone ahead and started up Fooocus
with the standard run.bat. I've changed a couple of settings with the quality and things
like that. I've gone ahead and generated a couple of images, and I'm actually going to
be using one of these specifically. But first thing you want to do is, in the bottom left,
there's the 'Input Image' checkbox. You're going to check that off. Once you do that,
you're going to have multiple tabs. You want to be on the 'Inpaint or Outpaint' tab. I do
have other videos that cover these features, the outpainting and the upscale variation,
image prompt. Those will be included in the description as part of this series. You want to
be on 'Inpaint or Outpaint' default; that's the one we're going to be using to start off with.
I'll show you the differences between those. Depending on what you're doing, you may find
some work better than others for certain things. Now, once you're ready, let's say we went ahead
and we generated an image, and this image is going to be a perfect example. I asked for green eyes
and a blue dress. Well, we got the blue dress but we kind of got blue eyes, which is something
that Stable Diffusion will do a lot. You may like the rest of the image, and you're just
upset, 'Well, the eyes aren't right.' Well, you don't want to have to regenerate it all.
So, this is where inpainting becomes very handy, because you just have to fix that one part
of the image. That's exactly what inpainting is perfect for. We'll just take the image and
drag it down to the bottom, like you know you can for anything else. We can also take generated
images that you've done before, bring those in. You can also bring in real photographs;
there's a lot of ways you can do this. Now, once the image is down here, you're
going to have several tools on the screen. You're going to have 'undo,' which will undo
your last step. 'Clear' will clear the mask that you've applied. 'Remove image' will remove
the image. And you also have the slider here to change the brush size. That brush is the mask of
what you want to change. So when you mask off or brush a certain area and mask it, you're telling
Fooocus that that's the part that you want to alter. It won't change anything else, and it
will try to blend that whole thing together. You also over here have tool tips, and these
are actually very useful. Shift plus wheel zooms in on the canvas. Control wheel changes
the size of the brush. You also have Control Z, which is undo. All R is a reset zoom; no matter
where you are, when you zoom in or anything else, if you hit R, it'll bring you right back to
where you are here. S is for full screen mode, which is very useful when you're editing certain
sections and you want to be able to zoom in. So here, we can zoom in, and we can really paint
the mask in fine details. And if you hold down F, it allows you to pan the image, which
makes it really useful for when you just want to change one certain part,
but you don't want to change the whole image. You can just paint that area and
change what you're looking to change. So, for this one, the first thing is, like I
said, the eyes were the wrong color. Mask the eyes initially and don't worry about if it's if it's
perfect. The biggest thing you want to remember is you want to make sure whatever you want to change
is masked and then overlap into the other areas. That way, the AI can fill in and blend everything
together. So, for this one, I'm going to go ahead at this point, and I'm actually just going to
hit 'generate.' I haven't changed anything else, I'm not going to change the prompt for this one.
I'm going to leave it exactly the same because I want the same prompt; I just want it to hopefully
fix the eyes. So, it won't touch the rest of that. The first time you go to generate, if you haven't
done it before, it could take some extra time, especially if you have a slower internet
connection because it does need to download the inpaint models and everything else in
the background. But once you've done that, those will stay on your system unless it needs
to update. The other thing is, a lot of times, depending on what you're doing, it may
need to upscale the image before it applies the inpainting. If that happens, sometimes
that can take a few minutes on your system. If you're unsure of what's happening, you can
always check your command prompt window to see what's happening in the background. And if after a
few minutes you find that the upscaling doesn't do it, you know, it just stops, I'll sometimes just
hit the enter key in the command prompt window, and it will give it a little bit of a kick
if it's stuck. If it doesn't do anything, then that usually means it's not stuck and it's
actually still doing something in the background. I know on my system when I'm recording, when
I try to do the upscaling and everything else, it takes much longer. So usually, I
recommend if you don't have a powerful enough system is doing this, is to shut
other things down that you're not using. So, we're going to go ahead and hit
'generate' and see what it comes up with for a couple of new images and
see if it fixes those eyes for us. Now, let's see the results of this. So,
we were hoping to change the blue eyes to green eyes. Look at this, so we
do have a definitely different eye color now. It may not be exactly what
I'm hoping for, and as you can see, it's changed the eyes in both of these. That's one
example of using inpainting to change an image. Now, at this point, let's say we wanted to use
one of these corrected images. So, we now have fixed the eyes; let's say that's what we want for
the eyes. I can go down here, I'll clear out the eyes. Now we have the changed image. But let's say
we don't like exactly how the hands are, for one thing. I think if we look here, the hands don't
look right. Basically, I'm not a big fan of that lower portion of the image. So, all I'm going to
do is actually just paint the mask down here, the lower half of the image, and I'm basically telling
it to just regenerate that section of the image. You can just do small areas. I find
a lot of times when you regenerate, if you just do small areas, it doesn't
always do as good of a job. If it has a larger area to work with, it seems to a
lot of times regenerate or do a better job. So, let's go ahead and see what happens
when we generate this one. Okay, so we have our new generations, and if we look
at these, we can see how they've changed the image compared to the original image. If we
pull that up, you can see how it's blended everything in together; you won't even see
any transitions or anything like that. Now, sometimes you kind of run into some
oddities, but for the most part, this does a very good job of matching with real
photographs and stuff. Sometimes it doesn't do as good of a job, so that can be trial and
error, but it does do a decent job overall. Now, let's say we wanted to
actually just go ahead and, well, we're going to pick one of these images.
I'm going to actually use this image here, we're going to clear everything. And now, let's
say we want to actually change her hair color. So, we could actually just go through and mask
out her hair. We could do it that way, or if you want, you can be more precise. It's
really up to you on what you want to change. So, I'm going to go ahead and actually mask
out any of the hair, and we're going to go into here. We didn't mention the hair color, and
so I'm going to put in here 'red hair.' That way, it's more noticeable. So, I'm going
to go ahead and now generate that. Okay, so our generation is done, we have
now red hair. We've now made quite a few changes to this image. We've changed
the eyes, we've changed the hair color, we've changed the lower part of the dress,
but we still have the same, the original image that hasn't changed. So, we can take and
fine-tune what we may like or not like about it. Now, the last thing I'm probably going to do with
this one is I am going to show one more thing. So, we're going to bring this down here, I'm
going to go ahead and clear everything. Now, at this point, I'm going to show you in here
'Improve Detail.' This will improve the details of the part that you mask, and now you do have
some additional prompts. These are just quick, quick list of options, but you can put in here.
You could do this on objects. If you had an apple, you could put 'detailed apple,' 'detailed
strawberry.' It doesn't have to be a body part; that's what a lot of people are going to use
it for, because it does work well for that. So, let's go with this one, and we're going
to zoom in on this. And as you can see, the teeth are not perfect on this. So, let's say
we want to fix that. So, we can go in here and put 'detailed smile,' and we'll go ahead and
regenerate to have it regenerate and actually improve the details. Stable diffusion,
when you, the further back the camera is, I find the details, the face, and everything else
start to fall apart, and this can be very useful for fixing that when you have like the eyes aren't
right, the mouth, or something like that. You can actually go back and fine-tune those things
on your final images to improve those details. So, let's go ahead and do that,
and we'll hit 'generate' again. As we can see here, it's basically zooming
in on just that one area, and it's going to apply more detail and improve whatever you
have there. This is useful a lot of times; you'll get eyes that just don't look quite
right, you'll get other minor details that just look a little weird. This is great for
fixing a lot of those small things after you have the primary image figured out, and you
just want to touch up those smaller details. Okay, so we've got the results. So, let's check
these out and see how these came out. And as you can see, it fixed the teeth and added more
detail. Now, if you don't like the results, obviously, you can generate multiple times until
you get the results that you want. Sometimes it may not blend perfectly, as with anything in
Stable Diffusion. So, that gives you an idea of how improving the details can work. You can do
the same thing with eyes, pretty much anything. It doesn't have to be a body part; it can be any
object, and it will actually improve the details. For this last part of the video, I'm going to
show you a couple of different things. One is, I'm actually going to use a real photo,
and I'm going to change the method down here to 'modify content' to show you the
third option under the inpainting. Now, there's a lot more information about
each one of these that I didn't cover, a lot more in-depth. This just gives you a
general idea. I will do more in-depth on those. At this point, I'm going to bring in a photo
of my goat, Tego, and we're going to try to see if I can add a crown onto his head. I've
entered what I want down here in the prompt, and I have this set under 'modify content.'
I don't need anything else at that point, so I'm going to go ahead and generate, and we're
going to see what the results are for this. Okay, and we now have Tego with a crown.
How well it may or may not blend things in, that's going to depend on a lot of different
factors, and you'll have to play around with a lot of these things to get exactly what you want. But,
you can see, that gives you an idea of some of the stuff that you can do. You can do, you know,
with actual photos, you can modify the content. Now, we could also do this just to
see how this would come out. So, let's say we did it the same way here: 'a
goat wearing a crown,' and we'll see how this comes out to get a comparison between the two
results. So, we now have a crown on him here, and these actually came out better. And
that's the thing with these two, with the standard method or the modified content. You're
going to have to experiment with both of those. The idea with the modified content is, it's meant
more for larger things. If you want to change a big part of the image, if you just want to change
a small part of the image, then you're probably going to want to, you know, you can just use the
standard method. I'm going to tell you, most of the time, that's what I use. I rarely ever switch
over to the modified content, unless I don't get something to work the way I want it to. I'll try
it that way, and sometimes that'll work better. It's always going to be trial and error when
it comes to that. There's a lot more to cover when it comes to inpainting, but this for right
now will get you going. And the biggest thing, as I can always say, is experiment. The
best way to learn and to find out more with Stable Diffusion, Fooocus,
or anything, any of these AI, is to experiment because there's no
guaranteed results with anything on these. That pretty much covers the basics of
inpainting and should get you started with fixing your images. If you found this
video helpful, please do consider clicking the like button because it does help. Any
questions or suggestions for video ideas, please leave a comment. Thanks for watching,
and don't forget, I do have other videos on Fooocus and will have more in the future,
so check those out, and have a great day.