Current location: Home> Ai Course> AI Basics

How to execute hires.fix in comfyui

Author: LoRA Time: 06 Mar 2025 1038

Performing "Hires.fix" in ComfyUI is not a native single node function, but requires combining a series of nodes to achieve an effect similar to "Hires.fix" in Automatic1111 WebUI. The core idea of ​​Hires.fix is ​​to create a low-resolution image and then improve the resolution and detail of the image through upsampling and secondary optimization. The following are detailed steps and methods, suitable for beginners and advanced users.

1. Understand how Hires.fix works

Hires.fix is ​​usually divided into the following steps:

  • Step 1 (First Sampling) : Create a lower resolution image (such as 512x512) to save computing resources.

  • Step 2 (upsampling) : Amplify the low-resolution image to the target resolution (for example, 1024x1024).

  • Step 3 (secondary optimization) : further denoising and detail optimization of the amplified image (similar to img2img operation) to improve image quality.

In ComfyUI, we can implement this process through node combinations.

2. Preparation

Make sure you have ComfyUI and its dependencies installed. If additional upsampling models are required (such as ESRGAN or other magnification models), you can download the model through ComfyUI Manager or manually and put it in the ComfyUI/models/upscale_models folder.

3. Basic Hires.fix workflow steps

Here is a simple workflow to implement Hires.fix:

Step 1: Create a basic workflow

  1. Loading the model :

    • In the ComfyUI interface, right-click the blank space and select Add Node > Loaders > Load Checkpoint to add a node to load the model.

    • Select your Stable Diffusion model (for example, v1-5-pruned-emaonly.safetensors ).

  2. Set text prompts :

    • Add two CLIP Text Encode (Prompt) nodes (Add Node > Conditioning > CLIP Text Encode) to be used for positive prompt and negative prompt respectively.

    • Connect the prompt word to the CLIP output of the Load Checkpoint node.

  3. Generate low-resolution images :

    • steps : 20-50 (sampling steps)

    • cfg : 7-9 (prompt word guidance intensity)

    • denoise : 1.0 (complete denoising)

    • Add an Empty Latent Image node (Add Node > Latent > Empty Latent Image) to set the width and height to a lower resolution (such as 512x512).

    • Add a KSampler node (Add Node > Sampling > KSampler) to connect the output of the model, prompt words, and Empty Latent Image .

    • Configure KSampler parameters, for example:

    • Add a V AE Decode node (Add Node > Latent > VAE Decode) to connect the output of KSampler to it, and use the VAE that comes with the model.

  4. Preview the initial generation result :

    • Add a Preview Image node (Add Node > Image > Preview Image) to connect to the output of VAE Decode to view low-resolution images.

Step 2: Upsample (magnify the image)

  1. Upsampling Latent :

    • Add the Upscale Image (using Model) node (Add Node > Image > Upscale Image) .

    • Load a Upscale Model (Add Node > Loaders > Load Upscale Model) such as 4x-UltraSharp.

    • Enter the VAE Decode image into Upscale Image and then convert it back to the Latent space using VAE Encode .

    • Add an Upscale Latent node (Add Node > Latent > Upscale Latent) to connect the KSampler 's Latent output to it.

    • Set the magnification (for example upscale_factor=2 ) to zoom in 512x512 to 1024x1024.

    • Alternatively, you can use an upsampling model of pixel space (e.g. ESRGAN ):

Step 3: Secondary optimization (detail repair)

  1. Second sampling :

    • denoise : 0.3-0.6 (low denoising intensity to avoid destroying the original image structure)

    • steps : 10-20 (less steps, focus on details)

    • Add another KSampler node and enter the upsampled Latent to this node.

    • Use the same model and prompt words, but adjust the parameters for detailed optimization:

    • Use VAE Decode again to decode Latent into an image.

  2. Save or preview the final result :

    • Add the Save Image node (Add Node > Image > Save Image) to connect to the output of the second VAE Decode , saving high-resolution images.

4. Use plugins to simplify the process

Although the above method is implemented manually, you can also simplify operations with some custom nodes or plugins. For example:

  • Ultimate SD Upscale :

    • Add the Ultimate SD Upscale node to connect the first generated image.

    • Set the target resolution (such as 1024x1024) and the upsampling model.

    • After running, the optimized high-resolution image is obtained directly.

    • This is a popular custom node that can achieve Hires.fix-like effects.

    • Installation method:

    • How to use:

    1. Search and install ComfyUI_UltimateSDUscale via ComfyUI Manager.

    2. Or manually clone the repository to the custom_nodes folder:


      git clone https://github.com/situ/ComfyUI_UltimateSDUscale.git
  • ControlNet Tile Upscale :

    • If you have ControlNet installed, you can use the ControlNet Tile model for chunked upsampling to avoid memory problems caused by large images at one time.

    • You need to download the controlnet-tile model and put it in the ComfyUI/models/controlnet folder.

5. Recommended parameter settings

  • First generation :

    • Resolution: 512x512 or 768x768 (supported according to the model)

    • Steps: 20-30

    • CFG Scale: 7-9

  • Upsampling :

    • Magnification: 2x or higher (visual video memory support)

    • If using ESRGAN, 4x-UltraSharp or Real-ESRGAN is recommended.

  • Secondary optimization :

    • Denoise: 0.3-0.6 (avoid too high, otherwise it will change the image style)

    • Steps: 10-20

    • CFG Scale: 5-7

6. FAQs and Optimization

  • Image details are lost : If details are lost after secondary optimization, try to lower the denoise value, or increase steps .

  • Insufficient memory : If the memory is insufficient, try to reduce the resolution of the initial generation, or use ControlNet Tile to block.

  • Style inconsistency : Make sure the prompt words for the second sample are consistent with the first, or use ControlNet to constrain the image structure.

7. Summary

Implementing Hires.fix in ComfyUI requires manual construction of workflows, but it is extremely flexible. The recommended process is:

  1. Generate low-resolution images.

  2. Zoom in with Upscale Latent or upsampling model.

  3. Use the second KSampler to optimize details. Or use the Ultimate SD Upscale plugin to simplify operations directly.