Image to image allows you to adapt upon any
existing image with a diffusion model. This video will walk you through the steps
on how to do this within Comfy UI. Let's take a look. Okay, so I have a blank Comfy UI workspace
here, so I'm going to go ahead and add the necessary node. So first off, I'm going to go ahead and get
the checkpoint loader, and then I'm going to use this default dreamshaper, I'm going
to load an image so we will have an image that we will take into the diffusion model. I'm going to load up the K-sampler, and so
this will go ahead and sample the image, and then go ahead and adapt upon it, and then
I'm going to go ahead and add in our prompts. So the positive and the negative prompts here,
we'll go ahead and connect that here, and then we'll get the negative prompt as well
too. All right, so this is a basic setup here. So what we need to do though is we need to
actually encode this image into the latent space before we can adapt upon it. So in order to do that, we need to put in
a latent image. So we will actually go ahead and put in a
VAE encode, so we'll go ahead and take that here, and then we'll use the VAE of the checkpoint
into this encoder. So then this will go ahead and adapt this
image so we can go ahead and run it through the diffusion model here. So I'm going to connect this to the latent
image. So now I'm going to go ahead and set up my
prompt. I'm going to go ahead and copy over the original
prompt for this image that I created. And say, for instance, I wanted to change
this person from 45 to 85 years old. So I'm going to go ahead and basically use
this model to go ahead and do this, and it's going to use this image as a initial source
for the latent space here. Now as far as the denoise, this goes on a
scale from zero to one. So basically if we leave it at one, it's going
to be a completely new image and we'll really know much about this original image, which
kind of defeats the purpose of what we would want for image to image for. Whereas if we set it to zero, the image would
have no changes whatsoever. So what we're going to do is going to set
this to about the 0.6 on a value here. So it's going to add noise to it and then
denoise it with this modified prompt that we have here. So I'm going to go ahead and put in a VAE
decode now. So we're basically encoding this. Now we're going to go ahead and decode it
so we can see the image again. And so I'm going to connect that noodle there. And then I'm going to go ahead and connect
this to the original models. So we can see the image. I'm going to go ahead and put preview image
and then connect these two together. So just the recap here is we have our original
source image. We're encoding it into the latent space and
then connecting it to this case sampler. We can use our original prompt that described
this image and make some sort of adaptions upon it, such as the age or whether or not
the subject had glasses, where they might have been standing, whether it was Antarctica
or say, for instance, some sort of city. Or of course, the negative prompt is well
too. So now whenever I acue this prompt and let
it go through the steps here, we can see what the green outlines that we'll see now how
we change the image from a person that was 45 years old, roughly, to a person that is
85 years old. So that is image to image within comfy UI. And you can use the same process for the stable
diffusion XL models as well too. And so yes, I hope that you found this video
helpful. If you have any questions, please drop a line
in the comment section below. And of course, if you liked or are interested
in the channel, please consider hitting the thumbs up and also subscribing. Thank you so much for watching guys and I'll
see you in the next one. Take care.