Hello again! In this little article I want to explain the upscaling methods that I know in ComfyUI and that I have researched. I hope they will help you and that you can use them in the creation of your workflows and AI tools. In addition, remember that if you have any useful knowledge, you can share it in the comments section to enrich the topic. Also, please excuse any spelling mistakes; I am just learning English hehe.
¡Let’s get to the point!
To the best of my knowledge, there are two widely used ways in ComfyUI to achieve uspcaling (you decide which one to use according to your needs). The two options are: Algorithm Method or Latent Method.
Algorithm Method:
This is one of the most commonly used method, and is readily available. It consists of loading an upscaling model, and connecting it to the workflow. That way the image pixels are manipulated as the user wishes. It is very similar to the upscale method used in the normal way of creating images in Tensor Art.
The following nodes are needed:
A. Load Upscale Model.
B. Upscale Image (Using Model).
These nodes are connected to the workflow between the “VAE Decode” and “Save Image” nodes; as shown in the image. Once this structure is created, you can choose from all the different models offered by the “Load Upscale Model” node, ranging from “2x-ESRGAN.pth” to “SwimIR_4x”. You can use any of the 23 available models and experiment with any of them. You just have to click on the node and the list will be displayed.
This can also be achieved in other ways by using another node such as “Upscale Image By”. The structure is simpler to create because only that node is connected between the VAE decode and Save Image as shown in the following image.
Once the node is connected, you are free to select the mode in which you want to upscale the image (Upscale_method) and you can also set the scale to which you can recondition the image pixel value (Scale By).
Strengths and Weaknesses of the Algorithm Method:
Among the strengths of this method are its ease of integration into the workflow and its advantage of choosing between several upscaling model options. It also allows fast generation both in the ComfyUI and in the use of AI tools.
However, among its weaknesses, it is not very effective in some specific contexts. For example: the algorithm can upscale the image pixels but does not alter the actual image size; causing the generated image itself to end up being blurred in some cases.
Latent Method:
This is the other alternative option to the algorithm method. It is focused on highlighting image details and maximizing quality. This method is also one of the most used in the Workflow mode of different visual content creation platforms with artificial intelligence. Here, upscaling is performed while the image is generated from latent space (Latent space is where the IA takes data from the prompt, deconstructs it for analysis and then reconstructs it to represent it in an image).
The Latent Upscale node is placed between the two Ksamplers. While the first Ksampler is connected to the “Empty Latent Image” node, the second one is connected to the “VAE Decode” to ensure the correct processing and representation of the generated image.
It should be noted that the “Empty Latent Image” node and the “VAE Decode” node are already included by default in the Text2Image templates in WorkFlow mode. (For more information about Text2Image, you can see my other article called “ComfyUi: Text2Image Basic Glossary”).
It is important to take into consideration that for this method to work properly, you have to know how to create a correct balance between the original size of the image and its upscaled size. For example, you can generate a 512x512 image and upscale it to 1024x1024; but it is not recommended to make a 512x512 image (square image) and upscale it to 768x11152 (rectangular image) since the shape of the image would not be compatible with its uspcale version. For this reason you have to pay attention to the values of the “Empty Latent Image” and the “Latent Upscale”, so that these are always proportional.
In the “Empty Latent Image” node you must place the original image dimensions (for example: 768x1152); while in the “Latent Upscale” node you must place the resized image dimensions (for example: 1152x1728). In this way you are given the freedom to set the image size to your own discretion. For this I always recommend to look at the size and upscale of the normal mode in which we create illustrations, this way we will always know which values to set and which will be compatible. As you can see in the image. You look at those values, and then write them to the nodes listed above.
Once everything is connected and configured, you are able to have images of any size you want. You can experiment to your taste.
Strengths and Weaknesses of the Latent Method:
As strengths this option should be highlighted that it allows you to access excellent quality images if everything is correctly configured. It also allows you to create images of a custom size and upscale with the values you want. It brings out the details in both SD and XL images.
As negative points we have to configure everything manually every time you want to change the size of the images or the shape of the same. Also, this method is just a little bit slower in the generation process compared to the algorithm method.
Which is better: ¿Algorithm or Latent?
Neither method is better than the other. Both are useful in different contexts. Remember that workflows will be different from user to user, because we all have different ways of creating and designing things.
It all depends on your taste and whether you want something simpler or more elaborate. I hope the explanation in this article has helped you to make Workflows more complex and to make it easier to make the images you want.
Extra Tip:
If you do not find any of the nodes outlined in this document. You can double click on any empty place in the workflow and you can search for the name of the node you are looking for. Just remember to type the name without spaces.