ComfyUI EP04 : (Smart) Inpaint with ComfyUI [Stable Diffusion]

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
[Music] [Applause] hello welcome to episode 4 of configure ad tutorial in this episode I will teach you how to do an impact technique in configure UI to let you modify the image in the way that you want okay oh so let's get started okay and we will try to generate some Image First for the first image I will generate beautiful Thai women wearing white T-shirt okay and this is my setting and we hit Q prompt okay to generate some Image First with this setting and this model you will got this picture okay if you really love this picture but you want to share something about this picture okay for example you want the T-shirt to be have some kind of graphic on the T-shirt or you might want to change the hair color if you want to change hair color okay you actually you can put the prompt in the positive prompt blonde hair okay one blonde hair however if you change the prompt if you change the prompt and heal prompt you might get another picture okay this is not the same okay this is the problem of using from to to change hair color if you're okay with this result it's up to you however if you really love the first picture okay if you really love the first feature you love the face the composition and everything but you you only want to change hair color you have to do an intent to fix this actually there are many techniques that you can do and in paint in coffee wine I will start from the most simple one first and then try to show you the more complicated one later okay first the first method you start with the load image the load image node I already told you in the previous episode it can you can browse New Image in this node or you can simply copy paste okay with this load image I will copy and paste image here okay and then in the load image you can right click and open in mask editor okay in the math editor you can put the mask which is uh the the black area with left click and you can use the right click to clear okay left left click to fill right click to clear and you also can change the thickness okay if you want to change the hair color you will you have to mask the area of the hair that you want to change okay you master hair color first and then you click save to note okay when you click save to note this node will have two outputs which is image and mask with mask if you drag out there will be many notes that you can choose however you you might find that you have this vaen code for in pen which is not the one that I recommend okay the one that I recommend is set Latin noise mask yes this one this one can can help you generate the image within the input area which works better than V8 in code for in paint okay it's much better you can try it by yourself but I will not show you with this note is output as Latin so you have to generate generate the the new stuff again with case sampler so I will copy paste the key assembler and put the Latin in Latin image okay and for the model I will use the model the first model okay for negative I will use the existing one it's not here however but for positive this one is mean we want to have uh blonde hair right we have to put another prompt okay so I drag the positive out and choose clip text in code okay and put brown hair not in here in this okay put one blonde hair in the positive and this one requires clip you direct clip okay and you can output the latent with we decode okay and you can preview or save image okay and this one requires vae so we plug the AE and you left with this one the sample right the sample this one needs latent okay this one need latent if you already have latent from the previous case sampler you can use it okay if you don't have the previous key sampler you can convert this image to uh that's it use vaen chords and put Latin in this this one is also okay okay this one can use this image and convert to the tint or you can use latent from previous case sampler is worth five both way okay with this and I will hit generate or hit Q prompt it will try to impend only the area of the hair okay and you you got blonde hair you got one hair you got blonde hair only in the area of the Mask okay however with this setting it's the noise one this means it will change a lot if you want to lower the the the chest only maybe you you can lower the D noise to be 0.5 and then Q prompt again this will change only 50 percent right it might look more natural okay it might look more natural and of course if you want to change another stuff like the graphic on the T-shirt or you can copy this result and paste back to the original load image one okay however if you do this The Mask will be destroyed you have to he did the math again which is okay for me because I want to match another area okay with this one I want to mask the the area on the t-shirt and maybe I will prompt something about the the graphic on the T-shirt okay I want the flower graphic on white T-shirt so let's try okay with this one it will try to put the flower on the on the T-shirt available if you want to change more okay you maybe put more the noise maybe 0.75 and try again yeah yeah this one has um more graphic on the T-shirt you can play with this stuff okay and you can play with the prompt okay you maybe want pink flower graphic you can specify anything okay it will be pink well I noticed that the The Mask area is too much in this it's too close so we can edit the mask to be have to have the better result and try again okay yes so we got the maybe better graphic and of course you can change the seat to be random and try many stuff okay if you random the seed the results will definitely change okay maybe the better one okay this is the first method with this very simple you you have to mask the area by yourself and you put the problem and change the result so I will explain you the second method which I like more than this method okay so let's go for the second method for the second method you have to download more custom node okay so you have to use manager and to use the more advanced technique to intent you should install custom node first the first one is configure I impact pack this one you can install then if uh if you finish you tell you to restart configure okay you close and then you close the back file and restart and we will install many things for you okay and you should wait and it might download something for you okay okay and then after that after finish everything if you want to use the more at once in paint feature okay for example this image I will browse for the one that this is the original one right this is the original one and then the second method that I want to explain to you is after you install the custom node the impact pack custom node you can right click on any image and then click open in sound detector okay with this tool it can help you detect the object automatically okay for example if I want to detect the shirt I can click at the shirt and detect however this one this detection also includes the face the hair and the skin of the girl it may be the model understand that we want the whole area of this girl but we don't want this big right so we can clear the area first and then put the confidence higher if the confidence higher it will detect more precise like if we only click on the shirt and detect okay it will detect only the shirt okay and okay if we lower the confidence active and detect it detect many things right we can also use the right click to exclude some area okay right click to exclude is also work however I think to use the higher confidence maybe better in this case Okay after we use this detection you if you okay with this you click save to node okay F2 node and then after this you can also manually adjust the math in math editor it's the same right this area it has some some kind of little black dot you can right click to create and this area you can put more on mask okay you can adjust something to make it perfect so to your needs you click save to note now you have the Mass area only the shot okay so I want to make it maybe yellow shirt yellow shirt and then try to you from I will try to change the area to be yellow set for you okay and then also put the the pants for you naturally if we hit Q prompt multiple times it will kill the prompt you can look at the queue with this button will kill and you'll see the queue some cue is running some Hue is pending you can cancel the running queue or you can delete the pending queue okay with this we will kill okay and it generate many a yellow shirt in in this result with this random C so the result message and you can also lower the noise the noise will look to be maybe 0.45 and generate again it will change only a little bit so maybe it's too low to to be able to change the color right so you may put 0.55 to let it able to change the color of the shirt or you can put it more to it change more okay it's up to you however with this approach you can see that the result in the edge area of the Mask is still white okay however if you want to get the better result from this you have to expand the mask a little bit right because this mass is too close to the edge of the shirt is not a cover in Thai shirt okay so if you want to expand it you can do it maybe one way is to do it manually by use math editor and you paint the area to cover the edge okay a little bit and another method is to use the node that we can install which is called masquerade okay if you install custom and usage the math they will masquerade node this one you install first and restart configure after you install the Masquerade node you can use the node in masquerade node okay there will be the one called mask morphology okay this one can expand the area of the Mask however you have to put the mask as the image so you drag the mouse out okay this one is original mask from the detection right and you use mask to image and convert it to image first and this one will expand the area of the mask and then we have to put the mass back into this one right so we disconnect this one delete okay and we have to convert the image back to mass which I recommend to use the Masquerade node again and use the image to mask okay drag to the image and drag the mouse if this if you use this setting it will expand the area of the The Mask by five pixel right and then you you prompt again the result should look better because it's already include the edge area more okay if you want more you you you can actually increase the area maybe seven or eight or something okay and you try again the area will increase a little bit okay and look for the result that you satisfy this is the second method which a little bit adjustment about the mask and for the final final method that I want to explain to you in this clip is something called clip set okay clipset to use the clip set here you use you have to install the step custom node first okay after that you can use the clip set so I will get rid of this mask first okay and then I will just try this mask first okay I opened in Mass editor and clear and save to node okay this is how we let's try the mask to use the clipset you add note all your search for click save okay let's say can input the image to clipset and then it can output the mask and can also show you the heat map of the Mask like uh if in the clipset no you can put the text which is the thing that you want to mask for example I want to mask the shirt okay the shirt and then if we try to connect this map and we try to preview the heat map okay and preview the black and white mask to see the result and then try to kill prompt this node will try to detect the area for you by the tip okay and it will load a little bit okay you see this clipstick is very powerful okay you can set the blur the threshold and dilation Factor Leisure factor is sometimes the area to expand out so this one is automatically it can detect the shirt right okay and then with this detection it's generated the new stuff for you okay already finished the result is I think is I think it's okay right however if you want to adjust the mask you can use use this black and white mask to do something later with masquerade again okay for the conclusion if you want to impend inconvenient I recommend that you use this note set the change noise mask which require the mass okay require the math and the Latin simple okay so if you use this node you have to provide the math area and the math area can come by many ways the first way is you to manually paint the area in the mass editor right the second way is to use Sam detector and the third way is to use use clipset to detect by the text that you want okay and you get the mass if the mass is not what you like you can eat it manually or you can use masquerade note to modify it and you output this Latin to another key example and this one you can use another positive prompt to specify what you want in the area and then it will generate the new image based on this prompt okay only in the in paint area this is the impend so if you have any question about this episode you can ask in the comment and you can also can request the topic that I that you need to learn more in the future episode I will do it for you okay for this time thank you for staying until the end bye bye [Music] foreign foreign [Music]
Info
Channel: AI Angel Gallery
Views: 8,522
Rating: undefined out of 5
Keywords: ai, stable diffusion, comfyui, tutorial, ai art, digital art, generative ai, สอน, เอไอ, artificial intelligence, sd, inpaint, partial fix, inpainting, clipseg, SAM, segment anything, mask, Masquerade
Id: 9jB2271-iEE
Channel Id: undefined
Length: 22min 38sec (1358 seconds)
Published: Mon Aug 14 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.