[0:00] this is the ultimate AI image generator [0:04] it's free and open source and the [0:06] awesome thing about it is you don't even [0:08] need an Nvidia GPU you can run it with [0:10] just a CPU or an apple M1 or M2 Chip and [0:15] it gives you total control not only can [0:18] you do text to image but also image to [0:21] image plus upscaling plus you can [0:24] control the poses of your character or [0:27] you can control the positions of objects [0:30] in your image or you can control the [0:32] depth of your composition and much more [0:35] you can also do face swapping and create [0:38] consistent characters you can also link [0:41] to popular AI tools such as mimic motion [0:44] which makes your character dance or live [0:47] portrait which lets you animate any [0:50] photo of a face or tun crafter which [0:53] allows you to input a start frame and an [0:56] end frame and it would generate an anime [0:59] scene in between those two frames the [1:02] possibilities are just endless now the [1:05] tool that we're going to go over today [1:07] is called comfyi and the interface looks [1:10] like this so if you're seeing this for [1:12] the first time this might look very [1:14] complicated to you and that's exactly [1:17] why I'm making this tutorial I'm going [1:19] to show you step by step how to install [1:21] it and then how to do text image image [1:24] to image upscaling how to control the [1:28] pose or the composition or for the depth [1:30] of your images plus how to download and [1:33] use external tools like face swapping or [1:36] toun crafter I'm going to make it as [1:38] easy as possible so that even if you [1:40] don't have any technical background on [1:43] AI or stable diffusion you can still [1:46] follow along easily so let's get started [1:48] all right first let's go over how to [1:51] install comfy UI you simply have to go [1:53] to their GitHub which I'll link to in [1:55] the description below and installing it [1:57] is really easy all you got to do is [2:00] scroll down and then you'll see this [2:02] installing comfy UI section and then [2:04] note that you don't need an Nvidia GPU [2:07] to run this you can also run it on CPU [2:10] only and it also supports Apple M1 or M2 [2:15] although of course if you do it this way [2:17] or if you run it using CPU it's going to [2:19] be way slower compared to an Nvidia GPU [2:23] so if you're serious about running image [2:25] generation locally definitely do get an [2:27] Nvidia GPU it's just going to make your [2:29] life a lot more easier and it's going to [2:31] be compatible with a lot more other [2:33] open- source AI tools by the way I'm [2:36] using a Dell Precision 5690 you can [2:39] integrate a powerful RTX 5000 Ada into [2:42] this huge thanks to Dell and Nvidia for [2:45] sponsoring this anyways I'm using [2:47] Windows so under Windows all you got to [2:49] do is click on this direct link to [2:51] download so this is going to install a [2:54] 7z file which we can unzip now note that [2:57] this is 1.4 GB in size so it's going to [2:59] take a few minutes to download depending [3:01] on the speed of your internet all right [3:03] so once you've installed the 7zip file [3:06] you can unzip it with 7zip or WinRAR and [3:08] then you're going to see this folder now [3:10] you can extract this folder anywhere so [3:13] I'm going to extract this on my desktop [3:16] and this is a very large folder so it's [3:19] going to take a while for this to fully [3:21] extract all right so once that is fully [3:24] extracted we can now open up the folder [3:27] and then depending on whether you have [3:29] an Nvidia GPU or something else double [3:32] click on the appropriate bat file so in [3:35] my case I do have an RTX 5000 so I'm [3:37] going to run this and then you might see [3:39] this message so we got to click more [3:41] info and then run anyway and so that's [3:44] how you would install comfy UI very [3:46] simple to use now if you click on Q [3:49] prompt you're going to see this error [3:51] message we don't actually have any check [3:53] points or models yet so we got to [3:55] download a model to use for our image [3:58] generation now there are are thousands [4:00] of models you could potentially use a [4:03] model basically defines the style of [4:05] your image so for example you can choose [4:07] from realistic to Disney Pixar style to [4:11] watercolor to anime there are like [4:13] thousands of checkpoints or models that [4:16] you can choose from and you can browse [4:18] all of these models in a site called [4:20] civit AI which I'll link to in the [4:22] description below now be warned though [4:25] there's a lot of NSFW content here so [4:27] make sure you have your filters on or [4:30] it's going to be very not safe for work [4:33] now because there are like thousands of [4:35] models how do you know which one is the [4:37] best of course you want to filter out [4:38] all the bad ones and just use the best [4:40] ones well there's an awesome site called [4:43] image cyst which I'll also link to in [4:45] the description below this is basically [4:47] a rankings list where users can kind of [4:50] blind test different models and then all [4:52] these results are accumulated into this [4:54] ranking list so you can see for example [4:57] that real viz has the most points so far [5:00] followed by colorful XL followed by [5:03] playground version 2.5 followed by [5:06] Juggernaut which is also a very popular [5:08] model and note that most of the ones at [5:10] the top are using stable diffusion XL [5:13] which is basically a higher quality [5:16] version compared to stable diffusion 1.5 [5:19] so let's say we want to use this one [5:21] real viz XL I'm going to copy this name [5:23] and in civii I'm going to Simply search [5:25] for this so here is real viz XL version [5:28] 4 and here are the results you can see [5:31] if you scroll down here are some sample [5:33] images from other users so let's just [5:36] download the most recent one version 4.0 [5:39] lightning so let's go ahead and download [5:41] this it is 6.4 GB just a warning so it's [5:45] going to take a while to download and [5:46] then you would place your download which [5:49] is a safe tens file in comfy UI and then [5:52] models and then checkpoints so let's [5:55] save it directly in this folder so once [5:57] you've downloaded the checkpoint or the [5:59] model file make sure that it is located [6:02] in comfy UI then in models and then in [6:05] checkpoints so notice that I have [6:07] downloaded this real viz XL safe tensors [6:10] file in this folder and so the next time [6:12] you start up comfy UI which I'm going to [6:15] do now you should be able to select the [6:17] model so again I'm going to open run [6:20] Nvidia GPU dobat and then wait for this [6:22] to give me a link all right perfect so [6:26] now if you go back here in the load [6:29] checkpoint point if it doesn't [6:30] automatically select one for you you can [6:33] click on this and note that I can select [6:35] this real viz safe tensor file in here [6:38] now note that for other tutorials they [6:40] suggest that you download the sdxl base [6:43] file and also the sdxl refiner file but [6:46] this is just the default stable [6:49] diffusion XL model actually this is not [6:52] necessary and right now sdxl has gotten [6:54] so good that you don't really need to [6:56] use the refiner file anymore in most [6:58] cases and and this Bas sdxl model it's [7:02] not great so you don't have to download [7:04] this and you can save a few gigabyt of [7:06] dis space again if you look at the [7:08] rankings from image Cy the sdxl base [7:11] files at least the lightning model seems [7:13] to be in 12th Place so I wouldn't [7:15] actually recommend you download this [7:17] base model and the refiner model so you [7:19] can actually save a few gigabytes of [7:21] disk space so anyways back in here all [7:23] we need to do is download whatever model [7:25] you want and then here is the positive [7:28] prompt and then here's the negative [7:29] prompt you can use your Mouse's scroll [7:32] wheel to zoom in and out and I'll [7:34] explain what all these boxes mean in a [7:36] second but first let's just generate an [7:38] image to see if this all works so for [7:41] the positive prompt I'm going to enter a [7:43] castle in a forest and then for the [7:46] negative prompt this is basically all [7:48] the things you don't want to see in your [7:50] image for example I don't want to see [7:53] people cars KN and that's pretty much it [7:56] I'll cover some more advanced prompting [7:58] techniques later in this video but let's [8:00] just click Q prompt for now and you can [8:02] see right now it's running this box [8:05] which is highlighted in green and then [8:07] it's running the positive prompt the [8:08] negative it's going through the K [8:09] sampler and then now you can see the [8:11] progress bar is up here so it's in the [8:14] process of generating the image and then [8:16] it goes through this VA decode and [8:18] finally we get an image of a castle in [8:20] the forest now this image is not great [8:23] and we're going to go over how we can [8:24] make this better now first I want to [8:26] really give you a solid understanding of [8:29] what all these boxes mean because I [8:31] think it'll help you when you build more [8:33] complex workflows so first of all let's [8:35] just ignore all of this and start from [8:37] scratch so if I move down here you can [8:41] start a new box or node by right [8:43] clicking and then you can see add node [8:45] and you can select whatever you want now [8:47] there are so many options here I [8:49] wouldn't recommend this way so another [8:51] way to do it is to doubleclick and then [8:53] after you double click you can actually [8:55] search for whatever node you want so if [8:57] I type in checkpoint for example you you [8:59] can see that we have a low checkpoint [9:01] node here so I'm going to select this [9:03] and because the real viz model is the [9:05] only model I have in this models folder [9:08] it selects this by default so again this [9:11] checkpoint basically defines the style [9:13] of your image for example there's going [9:15] to be some that work particularly well [9:17] for anime some that work well for [9:19] realistic photos and then some that work [9:21] well for Disney Pixar like characters [9:24] all right so next we need to add in our [9:27] positive and negative prompts now again [9:29] and we can either rightclick and try to [9:31] find the positive prompt node here I [9:34] would not recommend that it's really [9:35] hard to find a node in these options or [9:38] you can doubleclick and then search for [9:40] the node here in which case we see it [9:43] here or another way is to drag from one [9:46] of these connectors so the prompts [9:47] should be linked to this clip connector [9:49] so I'm going to drag a noodle out and [9:51] then once I release it you can see that [9:53] it gives me several options which it [9:56] thinks is most relevant and indeed the [9:59] prompt window is this one clip text and [10:02] code so we actually need to drag two of [10:06] these one for the positive prompt and [10:08] one for the negative prompt now there [10:09] are several ways to clone this node so [10:13] one way is to right click on this and [10:15] then click clone in which case we'll [10:18] have another node here but then we'll [10:19] need to connect this ourselves so I'm [10:21] just going to delete that and then [10:23] another way is you can just click on [10:25] this and press crl C to copy it and if [10:27] you press crl V to paste it this is what [10:30] you get but if you want this to have the [10:32] same connectors as this original node [10:35] then instead of pressing contrl + V you [10:37] can press contrl shift V and so now when [10:40] I paste in this node it's automatically [10:42] connected to this now just to avoid [10:44] confusion you can also rename this so [10:47] for example you can set the title to [10:50] positive prompt and and then press okay [10:53] and then here you can right click and [10:55] then set the title to negative prompt [10:58] and then press okay you can also set the [10:59] color if you want so for example I can [11:01] right click and then in colors I can set [11:04] this to red and this is important [11:06] because when you build more complicated [11:08] workflows this graph is going to be [11:10] really complicated so if you color code [11:12] things and rename these nodes it just [11:14] keeps things more organized and helps [11:16] you avoid confusion all right next step [11:19] is we need something called a case [11:21] sampler and it's basically an algorithm [11:24] that takes in your prompts and takes in [11:26] a latent image which we'll go over in a [11:28] second and create an image from that so [11:31] if we click on this conditioning [11:34] connector and drag it out we should see [11:37] K sampler here so I'm going to select [11:39] that this is for the positive and then [11:40] for the negative prompt we will connect [11:42] this to here and then for the model we [11:45] just drag this one all the way to here [11:48] where it says model and then for latent [11:50] image let's drag a line out and then [11:54] here it would give us the option to [11:56] create an empty latent image so so let [11:59] me just drag this over here to keep [12:01] things cleaner all right so what on [12:04] Earth does this mean what exactly is an [12:07] empty latent image so how stable [12:09] diffusion works is it doesn't create an [12:12] image from a blank canvas actually what [12:15] it does is it starts with an image of [12:18] just random noise and then at every step [12:20] it removes some of that noise and if you [12:23] remove enough noise you get whatever [12:25] image you prompted it with so this empty [12:27] latent image is basic basically an image [12:30] of random noise and you can select the [12:33] width and the height so for example we [12:36] can change this to 800 if you want and [12:38] then same with the height 800 by the way [12:40] for sdxl it's best to create an image of [12:44] 1024x 1024 because that is what it's [12:47] optimized for and then if you are using [12:50] stable diffusion 1.5 or earlier it's [12:53] best to use 512 x 512 and then the batch [12:56] size is how many images you want so if [12:59] you set this to two basically it will [13:02] create two images at once but for now [13:04] let's just set this to one all right so [13:07] next let's go over all these settings [13:10] the seed is basically the starting point [13:13] of this random image this image is just [13:16] random noise but there could be an [13:18] infinite number of images of random [13:19] noise each of them would be slightly [13:21] different so the seed basically defines [13:23] the starting point and usually we keep [13:26] the seed at random so that's what this [13:28] one does however if you keep it at fixed [13:31] and you set the C to a certain value for [13:34] example 69 then if all of the other [13:37] settings are the same you're going to [13:39] generate the same image every time [13:41] because the seed or the starting number [13:43] is the same but for now let's leave it [13:45] at zero and then for here let's set it [13:48] to randomize and then the number of [13:50] steps is basically again if we go back [13:53] to how stable diffusion works is how [13:56] many steps of noise removal do we want [13:59] so if it's just a few steps you're only [14:01] going to get something like this you [14:03] haven't removed enough noise yet and [14:05] after enough steps you're going to get a [14:08] very clean image of whatever you want to [14:10] generate so generally few steps would [14:13] give you a lot of noise and then after a [14:15] point like if you exceed 50 to 100 steps [14:18] then you're not going to get a better [14:20] image in fact you might get some noise [14:22] or artifacts because there's not much [14:24] remaining noise to be removed so I'm [14:26] just going to keep the number of steps [14:27] at 20 for now and then CFG is basically [14:31] how well do you want this algorithm to [14:33] follow your prompt so if you set this to [14:37] one for example it's not going to follow [14:39] your prompt and it's going to try to [14:41] generate whatever it wants basically it [14:43] can be more creative however if you set [14:45] it to 15 for example then it listens to [14:48] your prompt very literally and it tries [14:50] to generate whatever you specify in your [14:52] prompt which is sometimes not what you [14:54] want sometimes if it's too literal [14:55] you're going to get some weird results [14:57] so generally a value of like seven or [15:00] eight would work best and then the [15:02] sampler name this is basically the [15:04] algorithm that's used to remove this [15:07] noise and generate the image for you so [15:09] ooler is a common one this is one of the [15:12] fastest ones and then if you want to go [15:13] for Quality I would suggest one of these [15:16] so DPM PP 2m or 2m SD but for now let's [15:20] just go with ooler and then for [15:22] scheduler this basically gives even more [15:25] quality so usually if you want a really [15:27] good quality image would select Caris or [15:30] exponential these settings are just very [15:32] subtle differences you can add to the [15:34] image so just play around with it so you [15:36] can get a feel for what settings work [15:38] best for your particular use case and [15:41] then Den noise what this is is because [15:43] again our latent image or starting image [15:46] is basically an image of random noise [15:49] the den noising strength is basically [15:51] how much noise do we want to remove from [15:53] this initial image so if we're starting [15:56] from scratch then obviously we want to [15:58] remove 100 % of the noise so that's why [16:01] this is set as one all right so the next [16:04] step is we next need to connect this [16:07] latent connector so I'm going to drag [16:09] this out and we need to connect it to [16:11] what is called a VA decode a vae [16:15] basically encodes an image into a latent [16:18] space but right now we want to do the [16:20] reverse of that so we need to decode [16:23] this latent image into an image that we [16:25] actually want to see so that's why we [16:28] need this final step to decode this [16:30] latent image and then we need to drag [16:33] the vae from our checkpoint to this vae [16:37] connector that we see here so in most [16:39] cases your checkpoint should come built [16:42] in with a vae so all we got to do is [16:44] just connect this vae to this vae [16:47] connector here and then we are almost [16:50] done right now we just need to produce [16:52] the image so once we drag this out we [16:54] actually have two options we can either [16:56] preview the image so if we preview the [16:59] image it's not going to save the image [17:00] in our computer or we can select save [17:03] image which also shows us a preview of [17:05] the image but it also automatically [17:07] saves the image so I'm going to select [17:09] preview first because I don't want it to [17:12] save every image it generates I only [17:14] want to select the good ones to save on [17:16] my computer so I'm going to show you how [17:18] to save a previewed image in a second [17:21] there are very few software tools that I [17:23] use every day but this is one of them [17:26] thanks to our sponsor turbo type it's [17:28] free forever and it saves me so much [17:30] time basically you can create custom [17:33] keyboard shortcuts so that you don't [17:34] need to keep typing out repetitive [17:36] things for example if there's a prompt [17:38] that I use in chat GPT very often I can [17:40] make a shortcut here and then when I go [17:43] to chat GPT or anywhere else I just need [17:45] to type in the shortcut and voila or [17:49] let's say I have a very long email [17:51] address I can also make a shortcut for [17:53] that so that whenever I need to enter in [17:55] my email I can simply type in the [17:58] shortcut and it types out the email [18:00] finally it also supports Rich Text for [18:03] example you can add in bold and italics [18:05] and add links to your text as well so [18:07] let's say I need to send out a lot of [18:09] cold emails with the following template [18:12] well I can just create a shortcut for [18:14] that and then whenever I start an email [18:16] I just need to type in the shortcut and [18:18] voila the text is already styled and [18:21] linked for me there are hundreds of [18:23] pre-existing templates that you can [18:25] choose from including common prompts for [18:27] chat GPT business finance medicine and [18:31] more this tool saves me so much time [18:34] every day there's absolutely no reason [18:36] not to use this because they have a free [18:38] forever plan so definitely check it out [18:41] and download the free Chrome extension [18:43] in the link below but that is pretty [18:46] much it so for the positive prompt let's [18:49] put a med evil Warrior realistic 8K [18:55] Masterpiece these are just some keywords [18:58] that I tend to use a lot to give it more [19:00] detailed and then also Ultra detailed is [19:03] another good one and then for negative [19:06] prompts again these are all the things [19:07] we don't want to see in our image so for [19:09] example I don't want it to painting or a [19:12] cartoon or anime drawing I don't want it [19:15] to have any copyright or watermarks and [19:19] I think we are good to go for now so [19:22] before we click run note that I had this [19:26] previously this is the default so I [19:28] don't want to to run both of these at [19:29] once so I'm going to select all of these [19:32] nodes and delete them so to select [19:34] multiple nodes at once what you can do [19:36] is hold down control and then drag to [19:39] Encompass all the nodes that you want to [19:41] select and then if you want to move this [19:43] group of nodes around you need to hold [19:45] down the shift key and then you can drag [19:47] this wherever you want and then to [19:49] delete everything at once all you got to [19:51] do is press delete all right so moving [19:54] back down here everything else looks [19:57] good so I'm going to press Q prompt so [20:01] note that it's starting here it's [20:02] loading the checkpoint and then it's [20:05] moving over to K sampler now it's [20:06] generating the [20:09] image and then it's decoding the image [20:12] and then voila we have a medieval [20:15] warrior so basically this is like the [20:18] standard workflow for a simple text to [20:22] image generation and then let's do [20:24] another one so let's say I want to [20:26] generate two images at once all we got [20:28] to do is increase the batch size to two [20:31] and then press Q prompt again and note [20:33] that it starts off here it starts in the [20:36] case sampler it doesn't start here or [20:38] here and that's because we haven't [20:40] changed any of these other nodes in a [20:42] previous step so all of this is already [20:45] saved in memory it only loads from here [20:48] and so this makes comy UI very efficient [20:52] and then so now we have two images this [20:54] is the first one here's the second one [20:57] and remember this is not saving your [20:58] image this is just the preview image [21:01] node so to save it all you got to do is [21:03] right click and then press save image so [21:06] this is the most basic text to image [21:09] workflow for stable diffusion hopefully [21:12] this gives you a better understanding of [21:14] what a k sampler is what an empty latent [21:17] image is and what a VA decode is because [21:20] once you set up more complex workflows [21:23] you're going to need to understand what [21:25] these nodes actually do so I hope this [21:27] gives you a good understanding all right [21:29] before we move on to the next section [21:31] let's go over some tips and tricks for [21:34] navigation and organization and [21:36] productivity so first thing is I'm not [21:39] sure if you can see it on my screen [21:42] share right now but there is a very [21:44] faint dark blue frame on your comfy UI [21:48] canvas so I'm hovering my cursor over [21:51] that frame right now I wish they could [21:53] make the contrast higher so you can [21:54] actually see the blue line but anyways [21:56] there's this very faint Blue Line and so [21:59] whenever you start an interface the [22:02] default location would be within this [22:05] blue frame so it's always best to have [22:07] your workflow within this blue frame so [22:10] that whenever you load up comfy UI your [22:12] workflow will show up right away and you [22:14] don't need to like try to find it within [22:16] this huge canvas all right next thing [22:18] you can do is let's say this is a [22:21] workflow that you want to use again in [22:23] the future you can click this to save it [22:25] or press crl s so let's name this this [22:29] as temp. Json and then you can save this [22:32] wherever you want I'm just going to save [22:34] this in the compi folder another [22:36] keyboard shortcut to be aware of ISR a [22:38] which is select all and then delete or [22:41] backspace which will delete everything [22:43] you've selected all right so right now [22:45] this whole workflow is gone now I can [22:47] undo it by pressing contrl Z which would [22:50] undo my delete of the workflow or I can [22:52] also redo the action by pressing control [22:54] Y which deletes the whole workflow again [22:57] now to load up a previously saved [22:59] workflow you can press load here or [23:02] press crl o so if we go into our compy [23:05] UI folder and then select this temp. [23:08] Json which we just loaded you can see it [23:11] has loaded our workflow back up now a [23:13] few shortcuts for navigation you can [23:15] either press on your mouse and then move [23:18] the canvas around or you don't actually [23:20] need to click on your mouse you can also [23:21] hold down the space bar and then move [23:23] your mouse around and it would still [23:25] move the canvas now you can zoom in and [23:27] out by using the scroll wheel and then [23:30] to select multiple nodes you just simply [23:32] hold down control and then select this [23:35] one and then let's say I want to select [23:36] this one and select this one so I'm [23:38] holding down control for each of these [23:40] and then let's say I want to delete [23:41] these I can just press delete and then [23:43] let me undo that by pressing contrl Z [23:46] you can also select multiple nodes by [23:48] holding down control and then dragging a [23:51] frame around all the nodes you want to [23:53] select and then if you want to move [23:55] these nodes around simply hold shift and [23:58] then you can drag this group of nodes [24:00] that you've selected wherever you want [24:03] another thing you can do is let me [24:05] delete this first now every time you [24:08] drag a connector out there's also an [24:10] option called reroute so if I click this [24:13] it's basically just an extra blank node [24:16] which extends your connection further so [24:17] it's basically the same thing as just [24:20] connecting this vae to this vae but the [24:22] nice thing about this is let's say you [24:24] don't want this line to be hidden behind [24:26] this node well you can d it out like [24:29] this so you can clearly see that this [24:31] line is being connected here and then [24:34] one more thing is right now you see that [24:37] for example in K sampler these values [24:40] are set in this node but what if you [24:43] want to set this value somewhere else [24:46] and then link it to here so for example [24:48] for CFG if you want to set this value [24:51] somewhere else and then link it to the [24:52] cas sampler you can right click on this [24:54] and then under convert widget to input [24:58] you can set any of these options to an [25:00] input so let's say we want to set CFG to [25:04] an input now you can see that CFG has [25:06] disappeared from here and it is now an [25:08] input connector so let's drag this out [25:11] and then we need to actually use the [25:13] node called primitive so right now this [25:16] value is set to seven it's connected to [25:18] this CFG input so the CFG of this case [25:21] sampler is 7 so that's how you would use [25:25] it all right one final thing I want to [25:27] share with you and this is really cool [25:29] let me press crl a and delete all of [25:32] these let's say I made an image [25:34] previously using com UI well if I drag [25:38] that image onto the canvas what happens [25:41] is it actually gives me the entire [25:42] workflow that I used to create the image [25:45] how cool is that so like if you go [25:47] online and other users have shared their [25:51] comy UI generations and assuming they [25:53] haven't deleted that metadata you can [25:55] actually download their image and then [25:57] drag and drop that image onto comy UI to [26:00] look at the entire workflow that they [26:02] used to generate that image this allows [26:05] you to learn really quickly so those are [26:08] like the basic things you need to know [26:10] for organization and productivity using [26:12] comfy UI so let's move on to the next [26:14] section first of all we need to install [26:17] this plug-in called comfy UI manager it [26:20] will make your life a lot easier for [26:22] installing extensions and plugins and [26:25] missing models so I'm going to link to [26:27] this GitHub repo in the description as [26:29] well and if you scroll down a bit they [26:31] will give you some installation [26:33] instructions so in our comfy UI folder [26:37] and then in our custom nodes folder we [26:39] just need to open command prompt here so [26:42] in this bar up at the top type in CMD [26:45] and this will open up our Command Prompt [26:46] and you can see that we are now inside [26:48] our custom nodes folder next all we got [26:50] to do is get clone this repo so we will [26:55] paste it in here now you do need to have [26:58] get installed first if you don't here's [27:00] how to install git if you already have [27:02] git installed feel free to skip to the [27:04] next section so all we got to do is [27:06] download the latest release for whatever [27:08] operating system you're using so I'm [27:10] using Windows so I'm just going to click [27:11] on download for Windows I'm running 64 [27:14] bit so I'm going to click on this to [27:15] download and it's now downloading this [27:17] exe file so once that's completed all we [27:19] got to do is open that exe file and then [27:22] follow the steps so I'm going to click [27:24] on next I'm just going to go with the [27:25] default install location which is [27:27] program file SLG so I'll click next for [27:30] that and then I'm just going to leave [27:31] this at the default and then I'm going [27:33] to click next again and click next here [27:36] we're just going to use the default [27:37] settings for all of these there's a lot [27:39] of settings that you need to go through [27:41] so I'm just going to click next for all [27:42] of these all right and then it should go [27:44] ahead and install all the files so this [27:47] might take a few [27:48] minutes perfect so now we have git [27:50] installed all right so assuming you have [27:53] get installed already you simply copy [27:55] this line and then paste it in here and [27:57] then press it enter and you'll see that [27:59] now we are cloning this comfy UI manager [28:02] into the custom nodes folder and then if [28:04] you actually open up your custom nodes [28:06] folder you can see this new folder [28:08] called comfy UI manager all right so [28:10] next we need to restart comfy UI so [28:13] going back in our Windows portable [28:15] folder we are going to run comfy UI [28:18] again and you can see that it has [28:20] detected that we have comfy UI manager [28:22] installed so it's now installing [28:24] dependencies all right so after you open [28:27] your comfu up I now you should see this [28:29] manager button in the right menu so next [28:32] I'm going to show you how to upscale an [28:34] image and then we're also going to move [28:35] on to some more advanced workflows like [28:37] image to image and control net and [28:40] installing other plugins so first let's [28:42] click on this manager button and then [28:45] the main buttons that you will use is [28:48] this one custom nodes manager there's [28:50] also a button where you can like update [28:53] comfy UI or update all or install [28:55] missing custom nodes for example if you [28:57] import ort a workflow that was made from [28:59] another user you might have some missing [29:02] models or nodes or dependencies so [29:04] clicking this button will just [29:05] automatically install all of them so [29:07] that this other user's workflow will [29:09] work on your computer and then here this [29:11] is model manager so instead of going to [29:14] civit Ai and browsing through all the [29:15] models you can just easily download the [29:18] model here through this interface so [29:19] let's click on this and then let's [29:22] search upscale and you should see a lot [29:26] of different upscaler algorithms so [29:29] usually the ones that I find work best [29:32] are real sran X4 this is for realistic [29:36] photos as the name implies and then [29:38] there's also 4X Ultra sharp which works [29:40] pretty good as well just to keep it [29:42] simple for this tutorial I'm just going [29:44] to download these two but definitely you [29:47] can install all these and play around [29:48] with it and see which algorithm works [29:50] best for you so I'm going to select [29:52] these two and then click install all [29:55] right so after it is finished installing [29:58] note that you need to click the refresh [30:00] button on the main menu to apply these [30:03] installations so we're going to click [30:05] close And then close again and then [30:07] click refresh all right let's dive in to [30:09] see how we can upscale images so we're [30:12] going to use the same prompts a medieval [30:14] warrior realistic 8K Masterpiece Ultra [30:17] detailed and then for the initial image [30:22] width and height let's set it to 512 now [30:25] I understand that for sdxl the optimum [30:28] dimensions are 1024x 1024 but in this [30:31] example I'm just going to show you a [30:33] really blurry and low resolution image [30:36] and then we're going to upscale it by [30:37] four times so you can clearly see the [30:39] before and after and then for the batch [30:42] size let's leave it at 1 for now number [30:44] of steps we can also leave it at 20 and [30:47] then here instead of preview image let's [30:49] delete that and then we can just drag [30:52] this image out and then we don't see any [30:54] upscale here so we need to click search [30:57] and then we can search upscale now there [31:00] are a few options one is upscale image [31:03] which is kind of the same as upscale [31:04] image bu and then we have upscale image [31:07] using model now I'll show you what this [31:09] one does first upscale image bu I would [31:12] not recommend this because this is [31:14] basically just upscaling your initial [31:17] image but it's not adding any details [31:19] it's basically just increasing the size [31:22] so let's say we want to upscale this by [31:24] two times so instead of 52 12 x 512 it's [31:28] going to be 1024x 1024 and then for the [31:32] image let's drag it out and we will have [31:35] a preview image node and also I want to [31:38] preview the image before we upscale it [31:41] so you can compare the before and after [31:43] so over here I'm also going to drag a [31:45] preview image node all right now let's [31:48] run this and see what we get so I'm [31:51] going to press Q [31:52] prompt all right so let's look at the [31:54] initial image this is only 512 x 512 so [31:59] I'm zooming in quite a bit and you can [32:01] see the details of his face are very [32:03] blurry and then let's look at the [32:05] upscaled image yes this is 1024x 1024 [32:09] but you can see the details are the same [32:12] this is pretty much the same image the [32:14] same blurriness we're not adding any [32:16] details here so again it's not [32:19] recommended to use this upscale image by [32:21] Method because you're simply just [32:23] resizing the image but you're not adding [32:25] more details to the image so I'm going [32:27] to delete this one and also this one so [32:30] next let's drag out another node and [32:33] this time I'm going to search upscale [32:35] again and then we are going to use [32:36] upscale image using model and then after [32:39] that we need to actually input an [32:41] upscale model so I'm going to drag this [32:43] node out and then we should get the one [32:46] and only option which is upscale model [32:48] loader so because I've downloaded for X [32:51] Ultra sharp and real s again we should [32:54] automatically see this over here now [32:56] both of these are for X so your output [32:59] image will be four times the resolution [33:02] if you want 2x for example well you can [33:04] go into manager again and then click on [33:05] model manager and then find an upscale [33:08] model that is only 2x like this real [33:10] sran X2 all right and then just one last [33:13] step is we need to drag out another node [33:16] to either save the image or preview the [33:19] image so if I run this [33:25] again you can see that [33:28] if I zoom in on both of these this is [33:31] 512 x 512 so the details are very blurry [33:34] but if you expand this image which is [33:37] like over 2,000 * 2,000 you can see that [33:40] the details are a lot sharper especially [33:43] the patterns on his helmet and on his [33:46] armor now this isn't the best way to [33:48] upscale it's actually best to do one [33:51] round of image to image first before we [33:53] upscale so I'll show you that in a [33:55] second so one more thing I want to [33:57] mention is that sometimes you don't want [34:00] to upscale all the images that you [34:02] generate you want to decide which image [34:04] you want to upscale because let's say [34:06] for this initial image you don't like [34:08] the design you don't like the [34:09] composition you don't want to proceed [34:11] further with upscaling and waste [34:13] Computing resources so how do we decide [34:16] if we want to upscale or not well first [34:18] of all you can break off a workflow by [34:21] selecting the node where you want to [34:23] break it off in this case I want it to [34:25] pause here so it only generates the [34:27] initial image but it doesn't proceed [34:29] further to the upscale unless I want it [34:31] to do that and then I'm going to press [34:33] crl M and this will mute the note and [34:36] basically everything that goes after [34:38] this point is going to be paused until I [34:41] unmute this node now when I press Q [34:43] prompt and it generates an image I can [34:46] decide whether I want to proceed further [34:48] with this upscale method and if I do [34:50] then I would unmute this node and press [34:52] Q prompt again however one thing to note [34:54] is in this case you do need to set the [34:57] same seed otherwise if you don't set the [34:59] same seed when you press Q prompt again [35:02] it's going to generate a completely [35:03] different image and then it's going to [35:05] upscale that image so going back to here [35:08] we need to actually set this to fixed so [35:11] it's going to be a fixed seed and then [35:13] so if we run Q prompt again you can see [35:15] that it's generating a new image and [35:18] that image is being fed into here and [35:20] then let's say I like this image I want [35:22] to upscale it then I would click on this [35:25] node which is now muted I'm going to [35:27] unmute this by pressing crl M so now [35:29] when I press Q prompt again you can see [35:31] it's actually proceeding from here and [35:33] then now it's upscaling this image and [35:35] we can now see our upscaled image so [35:39] that's one way to do it another even [35:41] more efficient option is if you go back [35:44] to manager and then click on custom [35:46] nodes manager and then let's search for [35:49] image Chooser and this is a node that's [35:52] created by Chris Orange let's go ahead [35:54] and install [35:56] this all right all right so it says [35:58] restart required so let's restart this [36:02] all right so we are back here now let's [36:05] say we want to generate four images and [36:08] we would choose one of them to go [36:10] through the upscale so let's increase [36:12] the batch size here to four and then we [36:16] can keep everything as is for the seed [36:19] actually we can set this back to [36:20] randomize and then yes this has to go [36:22] through this vae decoder to decode the [36:25] latent image and then instead of preview [36:27] image let me just delete that let me [36:29] also delete this node for now and then [36:31] let's drag this image out and we will [36:34] search for preview Chooser which is down [36:37] here and then for any images that we [36:40] select here we can then proceed to [36:42] upscale it so let me just run this for [36:44] you first so you can see what this does [36:47] so right now it's loading the checkpoint [36:50] again because we've restored the [36:51] interface now it's inputting the [36:53] positive negative prompts now it's [36:54] generating four images through this case [36:57] sampler then it's going to decode these [36:59] four images and then so now we have four [37:02] Images all right so let's say we want to [37:06] select this one to upscale so we would [37:09] click on this or if you want to select [37:11] more you can always increase the count [37:12] to two and then select this one for [37:14] example but I'm going to decrease this [37:16] to one and unselect this so we are only [37:19] going to proceed with this image through [37:21] the upscaler and then we simply click [37:24] progress selected image and then this [37:26] would go through the upscaler and it's [37:28] using our forx Ultra sharp model and [37:30] then voila here is our upscaled image so [37:33] in a nutshell that's how you do [37:35] upscaling now there is an even better [37:38] method to upscale images which kind of [37:41] uses image to image so next we're going [37:43] to go over how to do image to image and [37:45] then we're going to go back to this [37:47] better upscaling method all right next [37:49] I'm going to show you how to do image to [37:52] image so what I'm going to do is first [37:54] of all hold control and then Dr drag [37:58] these nodes to select all these nodes [38:01] I'm going to copy it and then paste it [38:05] somewhere here and then I'm going to [38:07] hold down shift and then move it to [38:09] where I would like all right now going [38:11] back to this another way instead of just [38:14] deleting this workflow is to hold [38:17] control and select all of this and then [38:19] press contrl B to bypass so if you see [38:22] the nodes highlighted in purple that [38:24] means it will be bypassed this will not [38:27] r run so only this will run all right so [38:31] this is our standard text to image [38:34] workflow right we have our checkpoint [38:36] and then we have our positive prompt our [38:38] negative prompt this goes into the K [38:40] sampler the K sampler takes an El latent [38:43] image which is just an image of random [38:45] noise and then after going through this [38:47] algorithm and going through this amount [38:49] of steps then the final step is we need [38:52] to use our vae to decode this latent [38:56] space back into an image that we want to [38:58] see now for image to image we don't want [39:01] to start with an image of random noise [39:03] right we want our input to be an image [39:06] so let me select this node and delete [39:09] that and then I'm going to double click [39:11] anywhere and then search for load image [39:14] so let me click on this so this is the [39:17] default but you can click this button to [39:19] upload an image I'm going to upload this [39:22] image now we can't just directly drag [39:25] this image to this Laton image connector [39:28] that's because we need to First convert [39:31] this image to a latent image and then [39:34] connect the latent image into here so [39:36] let me drag this connector out and you [39:39] should see the first option here would [39:41] be vae and code and that's exactly what [39:44] we want to do we want to use a vae to [39:48] encode this into latent space and then [39:51] drag the latent image onto this [39:54] connector all right and then where do we [39:56] get our VA [39:58] well we can just get the vae from the [40:00] checkpoint that we loaded so let's drag [40:03] this to here and then you can see that [40:05] everything is connected now we do need [40:07] to set up some additional settings for [40:09] the K Samplers so one thing I forgot to [40:12] mention is that if your checkpoint is [40:14] lightning it only takes around like 5 to [40:17] 8 steps you actually don't need 20 steps [40:20] that's the awesome thing about lightning [40:22] models and some models can even generate [40:25] a decent image in as few as two two [40:27] steps for us let's set the steps to [40:31] seven sampler schedule we can leave it [40:33] as is Den noise this is what we want to [40:36] change if you remember for our text to [40:39] image denoise this is saying to take our [40:43] lat an image of random noise and replace [40:45] 100% of that noise so that we get the [40:48] image that we specified in our prompt [40:51] but in this case because we're not [40:53] starting with random noise we're [40:55] starting with an image we don't want to [40:57] remove everything we want to retain some [41:00] of this image so in this case if you're [41:03] doing image to image the noising [41:04] strength means how much of this original [41:07] image do you want to remove so if you [41:10] set this to 100% or 1.0 in this case [41:14] it's going to remove everything from [41:16] this image you're going to get a [41:17] completely different image conversely if [41:20] you set this to zero then it's just [41:22] going to produce this exact image [41:24] nothing would change so depending on how [41:26] similar you want the image to be it's [41:28] better to have something in between so [41:30] let's do 3 first so it's more similar to [41:34] this image and then I'll show you an [41:35] example of8 for comparison all right so [41:39] now that we have everything in place [41:41] there's just one final step which is to [41:43] drag this image connector out and then [41:46] we are going to preview image let me [41:49] just reposition this here so you can see [41:51] the entire workflow and we are good to [41:53] go let's click Q prompt so it's our [41:56] first time starting this workflow so it [41:59] takes some time to load in the [42:00] checkpoints and then it's going through [42:02] the prompts it's taking this image and [42:05] encoding it it's now going through this [42:06] K sampler and then it's going to decode [42:09] the image and then preview the image for [42:11] us all right perfect so you can see if I [42:14] drag this over here just temporarily for [42:17] comparison this is image to image so [42:20] here's our original image here's our new [42:22] image and the denoising strength was set [42:25] to. 3 all right let me now try one with [42:30] 8 for example and you should see that it [42:32] would be less similar to the original [42:35] image so I'm going to set the denoising [42:37] strength to8 press okay and then run [42:40] this again and notice it's not starting [42:42] from the beginning it's starting from [42:44] here because this is the last note where [42:46] we changed the settings so again this [42:48] makes comfy UI very efficient and now [42:51] it's decoding it and you can see for [42:53] this one it's more different compared to [42:55] the original image [42:57] so basically in a nutshell this denoise [43:00] value determines how similar do you want [43:02] your output image to be compared with [43:05] your uploaded image all right now [43:07] remember how I said there's a much [43:10] better way to upscale images using image [43:13] to image well now that we've gone over [43:15] image to image and specifically the den [43:19] noising strength setting I can now show [43:22] you a much better way to upscale images [43:25] and this is one of the best ways to [43:27] actually upscale images in order for [43:30] this to work we need to download another [43:32] node so let's go into manager and then [43:35] click on custom nodes manager and this [43:38] time we are going to search for ultimate [43:40] SD upscale so let's click install here [43:44] and after it has installed it says we [43:46] need to restart com UI so let's click [43:49] that all right so let's start with the [43:51] default text to image workflow and I'm [43:54] going to show you how to set this up so [43:56] instead of the case sampler this new [43:57] node is basically going to replace the K [44:00] sampler so let me hold control and then [44:03] select all three of these nodes and then [44:05] click delete and then I'm going to drag [44:07] a connector out here and then search for [44:10] ultimate SD upscale and then we are also [44:13] going to connect the negative prompt [44:16] here we're going to connect the vae here [44:18] and also connect the model here this [44:21] time we are not going to use a latent [44:24] image so I'm going to delete that and [44:26] then instead we need to upload an image [44:28] so I'm going to drag a connector out [44:31] from image and then select load image [44:34] and then I'm going to choose this image [44:38] now this is a 512x 512 image that we [44:41] generated previously you can see it's [44:43] very blurry and then for the prompt we [44:46] are going to set this to the same prompt [44:48] that we used before which is medieval [44:51] warrior 8K Masterpiece Ultra detailed [44:55] realistic and then for the next negative [44:57] prompt again same as before we are going [44:59] to type in anime 2D cartoon painting [45:03] Watermark all right so we are almost [45:06] good to go one last thing is we need to [45:08] select an upscale model so let's drag [45:10] this connector out and then select the [45:12] one and only upscale model loader and [45:15] this will pull up the upscaler models [45:17] that we've downloaded previously in this [45:19] tutorial so let's go with 4X ultr sharp [45:22] and now what this ultimate upscale does [45:26] is called tiled upscaling so let's say [45:29] we upscale this by two what this is [45:32] actually going to do is break this into [45:35] four sections so it's 2x two and then [45:38] it's going to apply image to image for [45:41] each quadrant so it's going to generate [45:43] image to image for this one and then [45:45] image to image for this one and then [45:47] this one and then this one and then it's [45:49] going to stitch all four quadrants [45:52] together to give you your upscaled image [45:54] and now the trick is if you use image to [45:56] image image with this with a low Den [45:59] noising strength again this is how much [46:01] of your original image do you want to [46:04] retain then this method is actually a [46:06] lot better than than just upscaling with [46:09] 4X Ultra sharp so again the key here is [46:12] to set a denois strength to a relatively [46:15] low value I think 0 2 is a good start or [46:18] you could even go with 0.15 all right so [46:21] all of these settings we've gone over [46:23] before tile width and tile height just [46:26] refer to the dimensions of each one of [46:29] these quadrants so this one would be 512 [46:32] x 512 this one would also be 512 x 512 [46:36] or whatever you set here usually you [46:38] would just set this to the width and [46:40] height of your original image and then [46:43] mask blur and tile padding this just [46:45] refers to how well these tiles blend [46:48] together after they are glued back [46:50] together to form your final image so I [46:53] just tend to leave it at the default but [46:54] feel free to play around with these [46:56] settings if for some reason you get a [46:58] very obvious line in between tiles and [47:02] then that's pretty much it the final [47:04] step is to drag this connector out and [47:06] then I'm going to select preview image [47:09] all right so let's click Q prompt and [47:12] I'll show you what that gives us all [47:15] right so if you now compare these two [47:18] images you can see that this is a lot [47:21] more detailed and the details are a lot [47:24] finer now previously we did a a clean 4X [47:28] Ultra sharp upscale which looks like [47:30] this right the details are not great you [47:33] can see the hair doesn't really look [47:35] like hair same with his facial hair same [47:37] with his face it Still Remains blurry [47:39] now this is 4 * 512 so this is 2048 * [47:45] 2048 right now this is only 1024 x 1024 [47:48] since we upscaled it two times so to [47:51] give you an Apples to Apples comparison [47:54] we can either set this value to four [47:57] which would upscale it four times or let [47:59] me show you another trick you can do to [48:02] upscale this further and this really [48:04] shows the versatility of comy UI you can [48:07] literally just customize the workflow to [48:10] whatever you want so let's leave this to [48:13] two and then get rid of this and then we [48:15] can actually plug in another ultimate [48:18] upscale here so I'm going to click [48:20] search and then search ultimate again [48:23] and then for model we can drag model [48:26] here positive prompt we can use the same [48:29] one negative prompt we can also use the [48:31] same one vae we can drag that from the [48:34] model and then upscale model we can also [48:36] use the same one or a better way to do [48:39] this is let me just select this node and [48:41] delete it again is to click this press [48:44] crl V and then over somewhere here press [48:47] contrl shift V and it would [48:49] automatically link everything that is [48:51] linked from the node that you are [48:53] copying now we don't want this original [48:56] image to be linked here so let me get [48:58] rid of this linkage and instead we just [49:01] want to pass our 2x upscaled image to [49:04] here to upscale by 2x again all right [49:08] now the only thing that we need to [49:09] change is because this image that is [49:12] being passed here is now 1024 x 1024 we [49:16] should set the tile width here to 1024 [49:20] by 1024 all right so now if we drag this [49:23] out and select preview image let me run [49:27] this and I'll show you the insane [49:30] quality that this can generate compared [49:32] to if we just did a normal upscale [49:35] method like this all right so here is [49:38] our preview image let me just save this [49:40] first and then I'm going to pull both of [49:42] these side by side on the left this is [49:45] only using the 4X Ultra sharp to upscale [49:49] my image of 512x 512 to four times and [49:52] then this one is using ultimate upscale [49:55] to upscale my image four times now [49:58] notice the insane difference if I zoom [50:01] in on this guy's face and zoom in on [50:03] this guy's face notice how much more [50:06] details this ultimate upscaler is able [50:09] to generate his facial hair his eyebrows [50:12] his eyes are super detailed the lighting [50:15] on his nose also super detailed whereas [50:18] for this one on the left even though [50:20] it's the same resolution his face is [50:23] just blurry and his facial hair does not [50:25] look realistic his eyebrows his nose are [50:28] super blurry and then same with the [50:30] crown here you can see the details are [50:32] really lacking in this left photo [50:36] whereas for this one with the ultimate [50:38] upscale everything just looks super [50:40] sharp and crisp now notice that because [50:43] we are using image to image with a den [50:45] noising strength of 2 there are going to [50:48] be subtle differences from the original [50:51] image so for example you can see this [50:53] dude is looking straight at the camera [50:54] now whereas this guy is looking slightly [50:57] to the right and that's because it [50:59] doesn't just take the original image and [51:01] upscale it so if you really want to [51:03] retain a 100% of your original image [51:06] then I think this method is better [51:08] however if you're okay with changing [51:11] some of the details to get a much [51:13] sharper and more detailed image than [51:16] ultimate upscaler is one of the best [51:18] options out there so yeah at least for [51:20] now ultimate upscale or basically this [51:22] is tiled upscaling this is one of the [51:25] best methods to to upscale images and it [51:28] basically takes your image and breaks it [51:31] down into tiles and then for each tile [51:34] it does image to image but with a very [51:37] low denoising strength so that it [51:39] retains most of the original image but [51:41] it just adds more detail to that image [51:44] and then it glues all these tiles back [51:46] together to give you your upscaled image [51:49] this is one of the best upscaling [51:50] methods out there right now so that [51:52] covers upscaling next let's move on to [51:55] some more complex stuff [51:57] all right next I'm going to show you how [51:58] to use control net in comy UI now what [52:01] is control net and why do we need to use [52:04] it basically it's a tool to really help [52:06] you customize your image if you're [52:08] serious about image generation you got [52:11] to learn control net so for example you [52:14] can really control the pose of your [52:17] Generation by using an open pose [52:19] pre-processor so you would upload a pose [52:21] like this and I'll show you how to do [52:23] that in a second and all your [52:25] Generations would all align with this [52:27] pose so here's another example and you [52:30] can see all these Generations follow [52:32] this pose to some extent and you can [52:34] also adjust well how much do you want [52:36] your generation to follow your pose [52:38] here's another example it's so very [52:40] powerful tool instead of pose you can [52:43] also create a depth map and use that as [52:46] a reference so for example if you upload [52:49] this depth map all your Generations [52:51] would have the same depth map to some [52:53] extent including the lights including [52:55] the laptop top this is a really powerful [52:58] way for you to control what objects show [53:01] up in what areas in your image and then [53:03] here's yet another example this is [53:06] especially useful if you have multiple [53:09] characters and the scene is very complex [53:11] but you really want to control where [53:14] those characters are in the scene then [53:16] again this is a great tool to give you [53:17] more control over those settings instead [53:20] of a depth map you can also upload [53:23] something called a cany pre-processor [53:25] which is basically just lines and you [53:27] can see your Generations would follow [53:29] this canny image here is another example [53:32] so control net is very versatile there [53:35] are so many things you can do with this [53:37] something that's very similar to canny [53:39] is line art so it's essentially the same [53:42] thing you take an image and you break it [53:44] down into line art and then use that as [53:47] a reference image for your future [53:49] Generations so you can see all of these [53:51] Generations follow this line art to some [53:54] extent here are some additional examples [53:56] and if you want to generate anime [53:58] there's an even better line art [54:00] pre-processor called anime line art and [54:03] this is more optimized for anime so as [54:05] you can see here if you want the same [54:07] pose the same outfit for your character [54:10] but maybe you want different colors [54:11] different backgrounds well you can use [54:13] this option to generate those images [54:16] here's another example and then similar [54:18] to line art there's also scribble where [54:21] you can draw in some lines and then that [54:23] would also influence your generations to [54:26] some degree as you can see in these [54:28] examples this is also a good one so you [54:31] can take any image and break down that [54:33] image into different segments and use [54:35] that as a reference and you can see all [54:37] your future Generations would also [54:39] follow the guidance of this image here's [54:41] another complicated example and you can [54:44] see it's able to control for all these [54:47] objects very nicely you can see with [54:49] this segment pre-processor you're able [54:51] to control the location of all these [54:54] people all these objects very precisely [54:56] l in your image all right so let's Jump [54:58] Right In how do we use it so first of [55:00] all let's start with a very simple text [55:03] to image workflow this is just your [55:05] positive prompt negative prompt you're [55:06] taking in an image of random noise [55:08] you're plugging it through this case [55:09] sampler it's going to decode it and give [55:12] you your final image now let's start [55:14] with adding control net first of all in [55:16] this manager section let's click on that [55:19] and then we'll click on model manager [55:21] and then we'll search for control net [55:23] Union this is the newest contr control [55:26] net model and it basically includes all [55:29] of these options that we just talked [55:31] about so you don't need to go in and [55:33] install all of those pre-processors [55:36] separately so let's go ahead and install [55:39] this note that it is 2.5 GB so depending [55:42] on the speed of your internet this might [55:44] take a few minutes to download all right [55:47] after we've installed it note that we [55:49] need to click the refresh button so [55:51] let's click close here and then close [55:54] and then click refresh all right so how [55:57] do we use control net it might be not [55:59] intuitive but we don't actually link [56:02] control net to the latent image we [56:04] actually link it to the positive prompt [56:07] so let me select this node and delete it [56:09] first and then I'm going to move up here [56:11] for a bit so let's drag this connector [56:14] out and then search for apply control [56:17] nit so again it's not intuitive but [56:20] control net is actually applied to the [56:22] positive prompt before going into the [56:25] case sampler so we are going to drag [56:27] this conditioning connector back into [56:29] the positive connector of the K sampler [56:32] all right and then the next step is we [56:34] need to select a control net model so [56:37] let's drag this out and then it's just [56:40] the first option here which is control [56:42] net loader so if that control net Union [56:45] was the only thing you've installed this [56:47] is the only model you should see if not [56:49] you can click on this and it would have [56:51] a drop down of all the compatible [56:53] control net models that you've [56:54] downloaded but again this is the only [56:56] only one you need this is the newest one [56:58] and it contains all of these options for [57:00] you so you don't have to go ahead and [57:02] download each of them separately all [57:04] right so the next step is the image [57:07] first of all I'm going to double click [57:09] here and then type in load image and [57:13] then select this node and then let's say [57:16] I want to specify a certain pose for my [57:19] generation so I'm going to upload this [57:22] image and I want whatever I generate [57:25] down here to follow this pose so what we [57:28] need to do is actually load this image [57:31] to a preprocessor now in order to do [57:34] that we need to download another node [57:36] and you know this is kind of messy I [57:39] wish we can just merge all of these [57:41] nodes together into one node just to [57:43] keep things cleaner but anyways it is [57:45] what it is let's click on manager and [57:47] then click on custom nodes manager and [57:49] then we'll search for art Venture and [57:52] then you should see this one comfy UI [57:54] art Venture let's click on this to [57:56] install it and I'll show you what this [57:58] node does in a second all right so after [58:00] we've installed this node it says we [58:03] need to restart comy UI so let's click [58:05] on restart and then click okay all right [58:08] so we are back after the restart [58:10] everything is still here so what we need [58:13] to do is link our uploaded image to a [58:16] preprocessor which is the node we just [58:19] installed so let me drag this out and [58:22] then I'm going to search for control net [58:25] preprocessor and we should see this AV [58:27] control nit preprocessor so let's click [58:30] on this and then why did we install this [58:32] instead of all the other options we [58:34] could choose from because this node [58:36] allows you to select from a lot of [58:38] different options so for example we can [58:40] choose sdxl which is what we are using [58:43] right our checkpoint is sdxl and so the [58:46] reason why we downloaded this node in [58:48] particular is because it contains all of [58:51] the pre-processors you need all in one [58:53] node so basically you can select things [58:56] like open pose or depth or canny or line [58:59] art or all of these other examples that [59:01] I showed you previously so let's start [59:04] with the simple one let's start with [59:06] open pose so I need to convert this [59:08] image into an open pose image and then [59:12] for the SD version we are going with [59:15] sdxl and then resolution let's set this [59:18] to 768 and then let's set the width and [59:22] height of our final image to 768 as well [59:26] note that for sdxl it's actually best to [59:28] use 1024x 1024 and it doesn't have to be [59:31] square but just to make our generation [59:34] faster let's go with 768 and then [59:36] finally we just need to drag this [59:39] pre-processed image into the image node [59:42] of control net and then here the [59:44] strength is well how strong of an [59:46] influence do you want this control net [59:49] or basically this pose to influence your [59:52] final image so 1 is 100% 0 is 0% % if [59:56] you set this to zero then you're [59:58] basically not using control net at all [60:00] and so let's set this to something like [60:04] 0.8 for example and see what that gives [60:06] us all right so just a quick summary how [60:09] you would use control net is it actually [60:11] goes in between the positive prompt and [60:14] the case sampler and then for control [60:16] net what you need to do is upload an [60:18] initial image and you need to process [60:21] that initial image into whatever [60:23] pre-processor you select and then it [60:25] would turn that processed image and add [60:28] it to the control net so actually what [60:30] I'm going to do just to show you what [60:33] this actually looks like is I'm going to [60:36] drag a connector out here and then click [60:38] on preview image so you'll see what this [60:41] open pose image looks like and then what [60:44] I'm going to do actually is hold control [60:46] and select all these nodes and also [60:49] select this one and then press contrl B [60:52] to bypass them so that we are only [60:54] running this I want to show you what [60:57] these steps actually do so let me click [60:59] Q prompt and note that the first time [61:01] this loads it might take a while because [61:05] you can see that it's downloading this [61:07] open pose model from hugging face all [61:10] right so after everything is finished [61:12] downloading you can see the preview [61:14] image here so basically this [61:16] pre-processor is converting our uploaded [61:18] image into this pose image and then [61:21] feeding this into control net and this [61:24] would influence the pose of our our new [61:26] image so I'm going to hold down control [61:28] again and select everything Press contrl [61:31] B to unbiassed and then this time [61:34] instead of a medieval warrior let's try [61:38] a princess arctic tundra snowing all [61:43] right and then let's click Q prompt [61:46] perfect so if I drag my load image next [61:50] to this final image you can see that [61:54] this princess is following the pose of [61:57] my uploaded image to some extent and if [62:00] we want to follow her pose completely [62:03] then we would set this value or this [62:06] control net strength to one so that's [62:08] one example of how to use control net to [62:11] control the composition of your image [62:13] all right here's another example so [62:16] let's say I want an image similar to [62:19] this composition of mountains but I want [62:22] this to be sunset instead of this [62:24] lighting so I can use a control net I'll [62:27] upload this image and then instead of [62:30] open pose I would select something like [62:32] canny or you can also select depth if [62:35] you want you could also select line art [62:38] it really doesn't matter it really [62:39] depends on your use case and then we [62:42] leave everything else the same and [62:44] here's just a preview image so after the [62:46] pre-processor it looks like this this is [62:48] what the canny pre-processor does all [62:51] right so we plug this into control net [62:54] and then this time for the positive [62:56] prompt I just put in mountains and [62:58] Sunset and then all these other keywords [63:00] and then our final image looks like this [63:03] so again if I drag my original uploaded [63:07] image onto here just for a comparison [63:10] you can see that our final image matches [63:13] the shape of these mountains to some [63:15] degree but now it's Sunset instead of [63:18] this lighting how cool is that basically [63:20] there are so many different options you [63:23] can choose from for control net feel [63:25] free to just play around with all of [63:27] these pre-processors there are just so [63:29] many different pre-processor options you [63:31] can choose in control net to really give [63:34] you maximum control over the composition [63:37] of your image so that sums it up for [63:40] control net if you run into any errors [63:42] or issues just let me know in the [63:44] comments below and I'll try to help you [63:46] troubleshoot as much as possible but it [63:48] should be fairly easy to install [63:51] everything in just one click using this [63:53] manager button all right next I'm going [63:55] to show you how to install and use [63:58] external AI tools on comfy UI the [64:01] awesome thing about comfy UI is that it [64:03] supports a wide range of other [64:05] open-source AI tools for example there's [64:08] a comfy UI note for mimic motion which [64:11] allows you to create dancing videos from [64:13] a single photo or there's another comfy [64:15] UI node for tun crafter which is a [64:18] powerful tool for generating anime [64:20] scenes if you're not familiar with Toon [64:22] crafter check out this video where I did [64:25] a deep Di dive on how to install and use [64:27] it but basically you just need to enter [64:30] in a start frame and an end frame and [64:32] this tool will fill in an AI animation [64:34] in between those two frames plus there's [64:37] another comy UI node for another tool [64:40] called live portrait in this tool you [64:42] basically input an image of a face and [64:45] then you input a video of another face [64:48] talking or doing some expressions and it [64:51] can map those expressions onto your [64:53] input image if you want to learn more [64:55] about live portrait check out this video [64:58] anyways today I'm going to show you the [65:00] process of installing and using one of [65:02] these AI Tools in comi for us we're [65:05] going to use this tool called instant ID [65:08] at its core it's basically a face swap [65:11] that takes in a reference image of a [65:13] person's face and then Maps it onto your [65:16] generation so there are a handful of [65:19] face swap tools you can use for stable [65:21] diffusion such as RP or reactor or this [65:24] one instant ID which I find to be the [65:27] most realistic and best Fidelity so [65:31] here's the original instant ID page you [65:34] can see that it is really good for face [65:37] swapping as you can see here's Taylor [65:39] Swift here's some Chinese actress this [65:42] looks really good it really does [65:44] preserve the details of that person's [65:47] face even across all these different [65:50] styles of generations like it doesn't [65:52] have to be realistic you can also do [65:54] face swap for painting or drawings and [65:57] it even works with different angles so [65:59] even though you just have one image of [66:02] Taylor Swift's face this AI is able to [66:05] miraculously kind of guess what that [66:08] face would look like at these different [66:10] angles so anyways let's jump right into [66:12] how we would set this up on the GitHub [66:14] page which is called comfy UI instant ID [66:17] I'll link to this in the description [66:19] below if you scroll down a bit here are [66:22] the installation instructions so you can [66:25] either download or get clone this repo [66:28] into the custom nodes directory or use [66:30] the manager of course since we have [66:31] manager installed we're just going to [66:33] use the manager so going back to our [66:35] comfy UI instance I'm going to click on [66:37] manager and then click on custom nodes [66:40] manager and then search for instant ID [66:43] and then we're going to go with this one [66:45] the comy UI instant ID native support [66:48] and the nice thing about this one as it [66:50] says in the description is that it [66:53] implements instant ID natively and fully [66:56] integrates with comfy UI so let's click [66:59] on install and then if you open up the [67:01] command prompt while this is installing [67:03] you can see that right now it's cloning [67:06] the repo it's downloading all the files [67:08] all right so after that it says we need [67:11] to restart comy UI so let's do that I'm [67:13] going to click on restart and then click [67:15] okay and then after clicking on restart [67:18] you can see in the CMD window that it's [67:20] actually installing some additional [67:22] dependencies such as inside face so [67:25] depend ending on the speed of your [67:26] internet connection this might take a [67:28] while to download all right you can see [67:30] now it's downloading Onyx runtime GPU [67:34] all right so we've installed the nodes [67:36] we've installed Insight face and Onyx [67:38] runtime but we are not done yet so next [67:41] we need to download these Insight face [67:43] models so one of them is called Antelope [67:47] V2 which we can download here so it [67:50] seems to be a zip file on Google Drive [67:53] I'm going to click download and then you [67:55] get download that anywhere once it's [67:57] finished downloading open up the zip [67:59] file and then it says we need to move [68:01] this into comy ui/ models SL Insight [68:04] face/ models so let's go into our comfy [68:08] UI folder and then in models we need to [68:11] create a new folder and call that [68:14] Insight face and then within Insight [68:17] face we need to create another folder [68:19] called models so I'm going to create new [68:21] folder models and then within models we [68:24] should have this entel V2 folder so I'm [68:27] going to just drag and drop this into [68:30] here all right so let me exit out of [68:32] this and you can delete the zip file [68:34] afterwards and then we also need another [68:36] one so we need this main model which can [68:39] be downloaded from hugging face and then [68:42] placed into this directory and it says [68:45] you also need a control net and you need [68:48] to place it in the comy UI control net [68:50] directory instead of downloading it from [68:52] hugging face there's a much easier way [68:54] to download these which is through the [68:56] manager so let me open manager again and [68:59] then this time we are going to click on [69:01] model manager and then we are going to [69:03] search for instant ID and you should see [69:07] that down here we have these two options [69:10] the IP adapter and control net and this [69:13] is for cubic instant ID so it's for this [69:16] repo it's basically downloading this [69:18] model which is based on IP adapter and [69:21] this control net so we are going to [69:23] select both of these and then click on [69:25] install now note that this one is like [69:28] 1.7 GB this is 2.5 GB so it's going to [69:31] take a while to download all right so [69:35] once we have these two installed let's [69:37] click close And then close again and [69:40] then let's click on refresh all right so [69:43] let's start again with our very basic [69:45] text to image workflow so we have a [69:47] checkpoint here we plug in these prompts [69:49] and then the these prompts go through [69:51] this case sampler which takes in a [69:53] latent image and then it decodes that [69:56] image and it gives us our final image [69:58] let me just adjust the placements of [70:00] these to keep things more organized as [70:02] we add the additional instant ID nodes [70:05] all right so where the instant ID node [70:08] goes is actually in between the prompts [70:10] and the K sampler so if I drag this out [70:13] here and then click search I will search [70:15] for instant ID and I should see this [70:19] apply instant ID all right so let's drag [70:23] this over here I'm going to hold control [70:26] and then hold shift and drag these nodes [70:28] over here to keep things more organized [70:30] all right so let's remove this and let's [70:34] remove this so the negative prompt goes [70:37] to here and then our model goes here and [70:41] then the model is then connected back to [70:44] this K sampler the positive is connected [70:46] to the K sampler and then the negative [70:48] is connected to the K sampler yes [70:51] there's a lot of connections that needs [70:52] to be made and I wish this process was [70:55] simpler but it is what it is all right [70:57] and then we need to also input an image [71:01] so I'm going to drag this node out and [71:04] then click on load image and then I will [71:07] click upload and let me upload this [71:09] image of Will Smith and then as the [71:12] GitHub specified this also needs an [71:14] instant ID control net so let me drag [71:18] this out and then let's select control [71:21] net loader and in your options if you [71:24] search for instant ID you should only [71:27] see this one instant id/ diffusion [71:30] pytorch model so let's select this for [71:32] the control net model and then for [71:34] insight face we also need to drag this [71:37] out and select instant ID face analysis [71:40] and then for the provider since I have a [71:42] Cuda GPU I will select Cuda and then [71:45] finally for instant ID we also need to [71:48] drag a connector out and the only option [71:51] we see here is instant ID model loader [71:53] so let's select this and by default it [71:56] should just be this one IP adapter. bin [71:58] which is the file that we installed all [72:01] right so after all these things are [72:03] connected let's also look at these [72:05] values so the weight is basically how [72:09] important do you want this face to be or [72:11] how much influence do you want this pH [72:13] to be in your final image and then for [72:15] start and end again for stable diffusion [72:18] it basically takes a latent image of [72:20] random noise and through each step like [72:23] right here we've set it to 20 steps and [72:25] so for each step it removes a bit of [72:27] noise until it gets to step 20 so for [72:30] these start and end values it's [72:32] basically saying well at what step do [72:34] you want to start applying this face [72:36] swap and at what step do you want to [72:38] stop applying this face swap so let's [72:40] say if we set this to like 0.5 or [72:44] halfway basically this would stop [72:47] applying the face swap at step 10 since [72:49] we set the number of steps to 20 if we [72:51] set this to 1 then it's going to apply [72:55] the face swap at all steps right from [72:57] Step Zero to the last step all right and [73:00] then just a few more things we need to [73:02] tweak for the width let's set this to [73:05] 768 for the height let's set this to [73:09] 1024 and then for the positive prompt [73:12] let's say policeman realistic 8K [73:15] Masterpiece Ultra detailed and then for [73:18] the negative prompt we can say cartoon [73:21] painting anime blurry Watermark all all [73:25] right and if all is good we can click on [73:27] Q prompt and see what that gives us so [73:31] right now it's loading the checkpoint [73:33] and then it's going through these [73:34] prompts it's going through this apply [73:36] instant ID which will take in our loaded [73:39] image of Will Smith and all these other [73:41] variables and then finally it's going to [73:44] Output this image of Will Smith as a [73:47] policeman so here we go now face [73:49] swapping isn't just for generating deep [73:51] fakes right generating fake images of [73:53] real people you can also use face swaps [73:56] to create consistent characters right if [73:58] you want a certain character to have the [74:00] same face throughout your video or [74:02] throughout your animation or comic book [74:04] or whatever face swap is a really good [74:07] way to apply the same face to all your [74:09] Generations let's try something else so [74:13] the awesome thing about instant ID is it [74:16] doesn't just work for realistic photos [74:18] so you could also set this to let's get [74:21] rid of painting and then instead of [74:23] realistic let's set this to watercolor [74:26] painting and then let's click Q prompt [74:29] and see what that gives us all right [74:31] perfect so now we have a watercolor [74:34] painting kind of of Will Smith as a [74:37] policeman so I hope this gives you a [74:39] good understanding of how to install [74:41] these different custom nodes of external [74:43] tools and the awesome thing about comfy [74:46] UI is there are a lot of other tools [74:48] that it can support so for example [74:50] there's also an animate diff node for [74:52] comfy UI which helps you generate [74:55] animations from images and inside the [74:57] GitHub it should give you a [74:59] demonstration of what a workflow should [75:01] look like another person has created a [75:03] comfy UI node for tun crafter and this [75:06] allows you to take in one image as the [75:09] input frame and then another image as [75:11] the final frame and it would interpolate [75:13] an animation in between these two frames [75:16] so again here's the workflow for the tun [75:18] crafter node and yet another user has [75:21] created a comfy UI node for live [75:24] portrait and this this basically allows [75:26] you to take one input image and then one [75:29] video of a person moving their heads and [75:32] doing some strange expressions or [75:33] talking and it would animate that input [75:36] photo with this person's movements and [75:39] here they shared with you how the [75:41] workflow would look like in comfy UI so [75:44] again there's just so many custom nodes [75:46] that other users have created based on a [75:49] lot of different external AI tools and [75:51] that's what makes comfy UI awesome and [75:54] with this manager you can easily search [75:57] for all the nodes out there there are [75:59] like tens of thousands of different [76:00] custom nodes depending on what you would [76:02] like to do and that's what makes comfy [76:04] UI the most powerful free and open [76:07] source image generator out there all [76:09] right finally some of you might be [76:11] wondering well how do I use comfy UI [76:13] with the newest models such as oraflow [76:16] or flux well for oraflow actually [76:19] everything is the same this whole text [76:21] to image workflow is the same and the [76:23] only thing you need to change is the [76:25] checkpoint you just need to change the [76:27] checkpoint to this Aura flow saf enters [76:30] file see this video on how to install [76:33] and run oraflow with kyui and then for [76:36] flux the workflow is quite similar you [76:38] just need to tweak a few things like the [76:41] model and a clip loader plus the K [76:43] sampler see this video where I go in [76:46] depth how to install and run flux on [76:49] comfy UI however if you've watched this [76:52] tutorial you should understand the basic [76:55] of how to use comfy and how all these [76:58] nodes work so changing between stable [77:00] diffusion and flux and AA flow is [77:03] actually very easy and for this tutorial [77:06] I mostly used sdxl because it's still [77:09] the most mature platform out there there [77:12] are hundreds of models and luras you can [77:14] choose from plus hundreds of plugins and [77:17] tools such as control net and all of [77:20] these only work with stable diffusion [77:22] whereas for flux it's still quite new so [77:26] there aren't a lot of tools and [77:27] workflows built from the open-source [77:30] Community yet but once we do have more [77:32] of these tools let me know in the [77:33] comments and if you want me to do an [77:35] updated tutorial just for flux I'd be [77:38] happy to make one as well so that covers [77:41] my tutorial for comfy UI like I said in [77:44] the beginning this is free and open [77:46] source plus you don't even need an [77:47] Nvidia GPU to use this and the [77:50] installation is super easy if you [77:53] followed all the steps as outlined in [77:55] this video you should be able to get [77:56] comfy UI up and running on your computer [77:59] now in this tutorial we covered a lot of [78:02] different topics from text to image to [78:04] image to image to face swapping to a lot [78:06] of different workflows so if you get [78:09] stuck or you hit any errors along the [78:11] way let me know in the comments below [78:13] and I'll try to help you troubleshoot as [78:15] much as possible as always I will [78:18] continue to look out for the newest and [78:20] coolest AI tools to share with you if [78:23] you enjoyed this video remember to like [78:24] share subscribe and stay tuned for more [78:27] content also we built a site where you [78:29] can find all the AI tools out there as [78:32] well as look for jobs in AI machine [78:34] learning data science and more so check [78:37] that out at ai- [78:38] search. thanks for watching and I'll see [78:41] you in the next one