Stable Diffusion Inpainting Tutorial - 雙語字幕
In today's video, I want to talk about in-paint and how you can fix mistakes and improve your images with stable diffusion.
I am using the Stable Diffusion Forge interface.
For the model checkpoint,
I prefer the Juggernaut XL version 9 with the sampling method dpm plus plus 2m caras 30 sampling steps a size of 1024 pixels and a CFG scale of 7
I will start with a cinematic photo of a geisha in a futuristic interior and after I hit the generate button,
I get something like this I usually keep generating until I get something I like with fewer mistakes
I found a seed that kind of has one hand good and one hand bat so I can demonstrate in painting on it.
Under the image you have a button that lets you send the image to the image to image tab.
Here I change the denoise strength to around 0.6 or 0.65 and then I try to generate a version of it.
Now the generation looks the same because when I used a custom seed it took that seed also to the image to image tab.
So I will click on the dice icon to get a random seed instead and I will generate a Now,
with the image to image feature,
it changes the entire image,
sometimes it changes the face, sometimes the dagger, but maybe I like those and, you know, I only want to change a portion of it.
we have the in paint option.
Under the image you can see it says Copy to and a button named in paint.
Click on it to copy that image to the in paint tab.
In the top left corner you have a little I button.
Hover your cursor over it to see what shortcuts you have for the in paint tab.
I like to use S to go to full screen and then with Alt and the mouse wheel I zoom in.
After that, I paint the area I want to change, like in this case that hand.
Now the way I want it is a little more difficult to get right, but with enough tries it can be done.
In the prompt I include the style,
so in my case a cinematic photo,
then I describe exactly what I want to see in the such as a hand pointing to the camera with a finger,
I wanted it to look like the Geisha is pointing to the viewer as if she's saying, you are next.
Here we have a lot of options, but most of them work at default.
Mask Blur refers to how blurred the edge of the selection you painted is.
For mask mode, you two options.
In paint mask will change the area of the interior of the selection and in paint not masked.
We'll keep the selection, like in our case, the hand and paint everything else.
Most of the time, I use in paint mask.
I find not masked useful if I make a selection of a person.
And then, when it generates, it keeps that same face and changes everything else.
I use fill when I want to remove something from the image because it fills it with the color of the image,
and you can mention in the prompt what you want there,
like a wall,
a color,
or a If I try to use it on the hand, you can see it's not very useful because it kind of flattens everything.
So for this case,
the best option is to mask the original because we have some shapes there and we want to make it look better, like a hand.
By default, it was set to in-paint the whole area, which means you want to describe the whole scene.
However, I'd prefer to in paint only masked that way, the resolution of the image is concentrated
on that spot so I can get a better quality image.
For example, those 10 to 24 pixels are dedicated only for the hand, not for the entire image.
Now we have a lot more details there, so we got the right set.
We just need to generate a few times to get different seeds until we find one that works for us.
When you made the selection, it set a bounding box around that selection.
However, we can expand that selection to look at other places in the image,
so it can understand the context better and create better proportion and scale to fit the scene better.
I just add tiny, small dots that will expand that better.
If I generate again, you can see that it now looks at this portion of the image.
However, since there are tiny dots there, it will not change much and most of the changes will be on the actual hand.
Now, when you get a better version, you can drag that to in paint so it looks at the image and sees the shapes better.
better, I will undo those spots to get the bounding box back on the hand since we have a better version.
When it comes to in paint,
like any generation, it's not perfect so you have to keep playing around with settings until you get something you like.
After a few more tries, I got one hand.
I will drag that new image to the end paint, click on the eraser icon to remove the selection.
I will make the brush bigger and paint the gaseous face.
When I make the selection,
I try to include a little bit from the hair so it can see better what is around and try to blend it better.
It doesn't have to be perfect.
Here, I tried to click S again to go out of full screen, but didn't work because I
was on the brush, so I had to click outside then on S to return to normal.
Since we have a different selection, don't forget to change the prompt also, so I will make the prompt cinematic photo of a geisha face.
As you can see, we got a different face now, but we can do more.
We can make it smile if we want.
Or you can also make it cry if that fits better with your vision.
I will try one for a serious expression, but I think I like more the confident mood.
Let's try another example of a bunny in the desert and see what changes we can make with in paint.
Send it to the image to image tab, then copy the image to in paint.
Press S to go in full screen.
Change the brush size and paint the bunny head.
On the head, I go over the edge so it blends with the rest, but for the base where the bunny head.
it.
it.
I try to give it a shape on how I want my generation to look like in that area.
For the prompt, I describe what I want to see so I will add a robotic bunny head with a sci-fi look.
For the settings,
I'll choose in-paint masked,
with masked content is original, and in-paint area is only masked, I'll set the denoise strength to 0.6 and hit generate.
As you can see, now we have a bunny with a robot head.
I don't like how it blends with the body,
so in this case you can generate again,
or play with the denoise strength, or let's blur the edge of the mask a little and see if we can get a better version.
It looks like it blends better now.
We saw how we can modify different subjects, but what if we want to remove something?
I have here a toy boat on a pool,
I will send it to image to image and then in paint and I will select the entire boat with a brush.
face, I have to select the shadow if I want to get clean water without the boat.
I removed the boat from the prompt then used the same settings as usual,
with masked content original and in paint only masked denoise set to 0.6.
I hit generate and got a different version of the boat instead of only water.
Why did this happen?
Because with original masked content, I'm content, we keep whatever was there originally and get a different version.
To remove it, you want to use the fill option that will fill with a similar color of the image.
So now when we generate again,
we get some nice water,
we just have to play with mask and denoise settings or get a few tries to get it to blend better.
We changed and removed.
Now it's time to add something.
I will use this empty desert for this example.
I will paint a selection about the size of my subject I want to add.
Then I'll use the same settings with original and 0.6 denoise We'll add a cute bunny cowboy in the prompt and hit generate.
Sometimes you get nothing and sometimes you get just a tiny bit of that subject there.
That's because it didn't have shapes and forms to work on.
To add something there, we choose the third option called latent noise.
If I hit generate, look what happens.
We get some noise.
It's like the most beautiful alien abstract.
Okay.
Okay.
It's not what we want for the result, but it's the right settings.
We just need to adjust something first.
For this option,
you want to use a denoise strength of around 0.95 to We finally got our cowboy bunny there but because our selection was so big
the mass blur is small compared to the selection.
So I will increase the mass blur to see if we can get it to blend better.
Now it blends better but the selection is too small for the bunny to fit however that's not a problem.
Now that we have.
Like the overall shape of the bunny.
We need the latent noise anymore.
So what we can do is drag this new image to in paint and make a larger selection.
Then, we reduce the denoise back to 0.6 and change the masked content to original.
Now when we generate again, we should get a better version of the bunny.
I will hit generate once more to get a better version of the gun.
One more example for you.
Let's see what I did in the prompt.
The best way to get good hands is to not have them visible.
So them in the pockets are behind and we'll have fewer mistakes to fix.
First let's fix the face of the woman.
I am making a big selection and in this case I will keep the same prompt and the same settings as I usually do.
I will hit generate and I will get a better quality face.
Now I will drag this new image back to in paint and move to the next thing.
What if I want to change the shirt to a blue color?
This is where things get more complicated.
Even the word complicated is complicated.
I make a selection of it,
change the prompt to a blue shirt,
but somehow it's too strong for the option mask content original to I tried to increase the denoise strength a little,
but it still gave me the different variations of it.
We have an option that works better with colors of the fill option,
so I will try a few generations with that,
and as you can see it's not perfect, but I get a hint of a blue shirt in there.
If I increase the denoise too much, will get a better shirt but it will not fit the subject as well.
Now I will drag this image to in paint and then switch back to mask original because now we
have a blue color to work with.
You can also do this quicker in Photoshop by selecting and changing the color quickly then using that unstable diffusion so
it's easier to see the shapes and colors.
To help with blending, you can also try the option called Soft and Painting, select it and try some generations with it.
You can also expand it to access more options and settings.
I haven't played with all the options because most of the time I managed to get what I wanted,
but you also have the help tab where you can click and read more about what each option does.
If you found something helpful in this video, please give it a like.
Thank you and have a great day.
解鎖更多功能
安裝 Trancy 擴展,可以解鎖更多功能,包括AI字幕、AI單詞釋義、AI語法分析、AI口語等

兼容主流視頻平台
Trancy 不僅提供對 YouTube、Netflix、Udemy、Disney+、TED、edX、Kehan、Coursera 等平台的雙語字幕支持,還能實現對普通網頁的 AI 劃詞/劃句翻譯、全文沉浸翻譯等功能,真正的語言學習全能助手。

支持全平臺瀏覽器
Trancy 支持全平臺使用,包括iOS Safari瀏覽器擴展
多種觀影模式
支持劇場、閱讀、混合等多種觀影模式,全方位雙語體驗
多種練習模式
支持句子精聽、口語測評、選擇填空、默寫等多種練習方式
AI 視頻總結
使用 OpenAI 對視頻總結,快速視頻概要,掌握關鍵內容
AI 字幕
只需3-5分鐘,即可生成 YouTube AI 字幕,精準且快速
AI 單詞釋義
輕點字幕中的單詞,即可查詢釋義,並有AI釋義賦能
AI 語法分析
對句子進行語法分析,快速理解句子含義,掌握難點語法
更多網頁功能
Trancy 支持視頻雙語字幕同時,還可提供網頁的單詞翻譯和全文翻譯功能