What is ESRGAN?
Before diffusion models (like Stable Diffusion) became popular, the main player in image generation was GANs .
ESRGAN is an upscaling model inherited from that GAN generation.
ESRGAN is a Super-Resolution GAN for upscaling low-resolution images to high resolution.
It doesn't just enlarge; it draws "plausible details" while enlarging by 2-4 times.
It is very lightweight compared to upscaling with diffusion models, so there are still many opportunities for it to play an active role.
Model Download
There are a ridiculous number of models depending on the use case, but for now, let's use the following models.
RealESRGAN
ComfyUI Manager → Model Manager
Search for RealESRGAN x4 and Install it.
OpenModelDB
Models developed by volunteers are shared here.
There are models specialized for cleanup, so it's fun just to look around.
Upscaling with ESRGAN
{
"id": "a244ccf2-5842-47ed-a7fe-5252c37bb979",
"revision": 0,
"last_node_id": 5,
"last_link_id": 6,
"nodes": [
{
"id": 3,
"type": "UpscaleModelLoader",
"pos": [
451.29150787007677,
-191.52546058515136
],
"size": [
260,
58
],
"flags": {},
"order": 0,
"mode": 0,
"inputs": [],
"outputs": [
{
"name": "UPSCALE_MODEL",
"type": "UPSCALE_MODEL",
"links": [
2
]
}
],
"properties": {
"cnr_id": "comfy-core",
"ver": "0.3.76",
"Node name for S&R": "UpscaleModelLoader"
},
"widgets_values": [
"RealESRGAN_x4.pth"
],
"color": "#232",
"bgcolor": "#353"
},
{
"id": 1,
"type": "ImageUpscaleWithModel",
"pos": [
747.4225780470904,
-133.04868614724018
],
"size": [
247.4365767045455,
46
],
"flags": {},
"order": 2,
"mode": 0,
"inputs": [
{
"name": "upscale_model",
"type": "UPSCALE_MODEL",
"link": 2
},
{
"name": "image",
"type": "IMAGE",
"link": 1
}
],
"outputs": [
{
"name": "IMAGE",
"type": "IMAGE",
"links": [
6
]
}
],
"properties": {
"cnr_id": "comfy-core",
"ver": "0.3.76",
"Node name for S&R": "ImageUpscaleWithModel"
},
"color": "#232",
"bgcolor": "#353"
},
{
"id": 4,
"type": "SaveImage",
"pos": [
1029.6592249286493,
-133.04868614724018
],
"size": [
322.72727272727275,
387.2727272727272
],
"flags": {},
"order": 3,
"mode": 0,
"inputs": [
{
"name": "images",
"type": "IMAGE",
"link": 6
}
],
"outputs": [],
"properties": {
"cnr_id": "comfy-core",
"ver": "0.3.76"
},
"widgets_values": [
"ComfyUI"
]
},
{
"id": 2,
"type": "LoadImage",
"pos": [
451.29150787007677,
-75.36269847873763
],
"size": [
261.33100000000013,
357.303
],
"flags": {},
"order": 1,
"mode": 0,
"inputs": [],
"outputs": [
{
"name": "IMAGE",
"type": "IMAGE",
"links": [
1
]
},
{
"name": "MASK",
"type": "MASK",
"links": null
}
],
"properties": {
"cnr_id": "comfy-core",
"ver": "0.3.76",
"Node name for S&R": "LoadImage"
},
"widgets_values": [
"A_01.jpg",
"image"
]
}
],
"links": [
[
1,
2,
0,
1,
1,
"IMAGE"
],
[
2,
3,
0,
1,
0,
"UPSCALE_MODEL"
],
[
6,
1,
0,
4,
0,
"IMAGE"
]
],
"groups": [],
"config": {},
"extra": {
"ds": {
"scale": 0.9090909090909091,
"offset": [
82.10849212992323,
466.42546058515137
]
},
"frontendVersion": "1.34.6",
"VHS_latentpreview": false,
"VHS_latentpreviewrate": 0,
"VHS_MetadataImage": true,
"VHS_KeepIntermediate": true
},
"version": 0.4
}
🟩 Load any model into the Load Upscale Model node.
Correcting magnification
Most upscalers like RealESRGAN x4 have text like x4.
This is the magnification, and using this model to upscale will forcibly make it 4 times larger.
However, for example, when incorporating it into a Hires.fix workflow, 4 times is too large.
In such cases, add a process to shrink the image enlarged by the upscaler.
workflow
{
"id": "a244ccf2-5842-47ed-a7fe-5252c37bb979",
"revision": 0,
"last_node_id": 5,
"last_link_id": 5,
"nodes": [
{
"id": 5,
"type": "ImageScaleBy",
"pos": [
1024.6577912673977,
-133.04868614724018
],
"size": [
210,
82
],
"flags": {},
"order": 3,
"mode": 0,
"inputs": [
{
"name": "image",
"type": "IMAGE",
"link": 4
}
],
"outputs": [
{
"name": "IMAGE",
"type": "IMAGE",
"links": [
5
]
}
],
"properties": {
"cnr_id": "comfy-core",
"ver": "0.3.76",
"Node name for S&R": "ImageScaleBy"
},
"widgets_values": [
"nearest-exact",
0.5
],
"color": "#432",
"bgcolor": "#653"
},
{
"id": 4,
"type": "SaveImage",
"pos": [
1263.9592249286482,
-133.04868614724018
],
"size": [
322.72727272727275,
387.2727272727272
],
"flags": {},
"order": 4,
"mode": 0,
"inputs": [
{
"name": "images",
"type": "IMAGE",
"link": 5
}
],
"outputs": [],
"properties": {
"cnr_id": "comfy-core",
"ver": "0.3.76"
},
"widgets_values": [
"ComfyUI"
]
},
{
"id": 1,
"type": "ImageUpscaleWithModel",
"pos": [
747.9197809016003,
-133.04868614724018
],
"size": [
247.4365767045455,
46
],
"flags": {},
"order": 2,
"mode": 0,
"inputs": [
{
"name": "upscale_model",
"type": "UPSCALE_MODEL",
"link": 2
},
{
"name": "image",
"type": "IMAGE",
"link": 1
}
],
"outputs": [
{
"name": "IMAGE",
"type": "IMAGE",
"links": [
4
]
}
],
"properties": {
"cnr_id": "comfy-core",
"ver": "0.3.76",
"Node name for S&R": "ImageUpscaleWithModel"
},
"widgets_values": [],
"color": "#232",
"bgcolor": "#353"
},
{
"id": 3,
"type": "UpscaleModelLoader",
"pos": [
451.29150787007677,
-191.52546058515136
],
"size": [
260,
58
],
"flags": {},
"order": 0,
"mode": 0,
"inputs": [],
"outputs": [
{
"name": "UPSCALE_MODEL",
"type": "UPSCALE_MODEL",
"links": [
2
]
}
],
"properties": {
"cnr_id": "comfy-core",
"ver": "0.3.76",
"Node name for S&R": "UpscaleModelLoader"
},
"widgets_values": [
"RealESRGAN_x4.pth"
],
"color": "#232",
"bgcolor": "#353"
},
{
"id": 2,
"type": "LoadImage",
"pos": [
451.29150787007677,
-75.36269847873763
],
"size": [
261.33100000000013,
357.303
],
"flags": {},
"order": 1,
"mode": 0,
"inputs": [],
"outputs": [
{
"name": "IMAGE",
"type": "IMAGE",
"links": [
1
]
},
{
"name": "MASK",
"type": "MASK",
"links": null
}
],
"properties": {
"cnr_id": "comfy-core",
"ver": "0.3.76",
"Node name for S&R": "LoadImage"
},
"widgets_values": [
"A_01.jpg",
"image"
]
}
],
"links": [
[
1,
2,
0,
1,
1,
"IMAGE"
],
[
2,
3,
0,
1,
0,
"UPSCALE_MODEL"
],
[
4,
1,
0,
5,
0,
"IMAGE"
],
[
5,
5,
0,
4,
0,
"IMAGE"
]
],
"groups": [],
"config": {},
"extra": {
"ds": {
"scale": 1.1,
"offset": [
-190.3824169609858,
406.9800060396968
]
},
"frontendVersion": "1.34.6",
"VHS_latentpreview": false,
"VHS_latentpreviewrate": 0,
"VHS_MetadataImage": true,
"VHS_KeepIntermediate": true
},
"version": 0.4
}
🟨 You can adjust the magnification by changing the scale_by value.
Correcting only faces with GFPGAN
There is GFPGAN as a Face-specific restoration GAN .
It is a type of model that detects faces collapsed by noise and redraws them close to "learned beautiful faces".
It sometimes appears for the purpose of "fixing only the face while you're at it" in post-processing such as FaceSwap nodes.
We won't cover detailed usage here, but it's enough to remember that there is "a finishing GAN specifically for fixing faces" .