Extensions/ComfyUI-NAFNet-Residual
ComfyUI Extension

ComfyUI-NAFNet-Residual

Small ComfyUI node pack for using NAFNet models that output a residual so they output full image

By DraconicDragon·Created 12 days ago·Updated 12 days ago· 2
DraconicDragon/ComfyUI-NAFNet-Residual
Nodes1
On cloudLocal install
Categoryimage/restoration
Stars2
Updated12 days ago
Readme

ComfyUI NAFNet Residual

A small ComfyUI node pack for using NAFNet models (specifically this one: https://huggingface.co/DraconicDragon/NAFNet-VAE-DeGrid) that output a residual.

<img width="1114" height="290" alt="image" src="https://github.com/user-attachments/assets/f635acfe-138c-4b84-a3b9-68207d8f617d" /> <img width="1296" height="368" alt="image" src="https://github.com/user-attachments/assets/ddc89f05-a4b8-43f3-b02d-82e708000f46" />

The pack gives you two ways to use NAFNet:

1. Custom node

NAFNet Restoration is a dedicated node that lets you choose how the residual is applied:

  • Full - apply the entire residual.
  • Dark Pixels Mainly - only apply positive residuals. This option's result is similar to Nyquist Notch shader's result.
  • Bright Pixels Mainly - only apply negative residuals.

This is the safer option if you don't want to modify ComfyUI's normal upscale model behavior.

2. Patch

The pack also includes a global NAFNet Residual Patch setting.

It can be set to:

  • Disabled - normal ComfyUI/Spandrel behavior.
  • Full - apply the full NAFNet residual.
  • Dark Pixels Mainly - apply only positive residuals. This option's result is similar to Nyquist Notch shader's result.
  • Bright Pixels Mainly - apply only negative residuals.

The patch is only applied to models detected as NAFNet. Other upscale models are left alone.

The patch is mostly there for convenience, so you can keep using the normal Load Upscale Model → Upscale Image (using Model) workflow without adding another node.

If you use the patch, please report any problems you run into. In particular, please report issues where other upscale models are affected, or anything is still being changed when the patch is set to Disabled. The patch modifies ComfyUI/Spandrel internals, so testing across different versions and setups is useful. Maybe I will just remove the patch variant if it gives too many issues. Right now it's mainly a nice to have thing.

Installation

I published this node pack to Comfy Registry, so you should be able to find it in ComfyUI Manager.
Alternatively you can still go the manual way and:
git clone https://github.com/DraconicDragon/ComfyUI-NAFNet-Residual this repository into:

ComfyUI/custom_nodes/

Then restart ComfyUI.

For the custom node, load your NAFNet with the normal Load Upscale Model node and connect it to NAFNet Restoration.

For the patch, open the ComfyUI settings and look for NAFNet Residual. If the patch is enabled you can simply use the normal Load Upscale Model -> Upscale Image (using Model) workflow.

One thing to keep in mind: ComfyUI may reuse cached node results after changing the patch setting. Changing a value in a node used by the workflow or otherwise invalidating the workflow cache may be necessary before the new/changed setting takes effect.