Image Restoration: SUPIR
Restore a soft or noisy photo with SUPIR: generative detail at the same framing, guided by text.
Your output will appear here.
Inside the workflow
A read-only preview of the source template. Open it in Cloud to explore the nodes and make changes.
Loading the graph
Open full-size workflow previewFiles in this workflow
- Output
- Image
- Author
- Author unavailable
Call this model from your code
The request below uses the same prepared graph and settings as the Playground. Each submission can start a paid run; do not automatically retry a submission whose outcome is unknown.
What you need
- Runs on
- Comfy Cloud
- Key
- COMFY_API_KEY
- Your files
- Uploaded by the code from their urls
Needs a paid Cloud plan and credits.
# Python 3.10+: pip install comfy-sdk==0.4.0
import os
from comfy_sdk import Comfy
api_key = os.environ.get("COMFY_API_KEY", "").strip()
if not api_key: raise RuntimeError("Set COMFY_API_KEY")
os.environ.setdefault("COMFY_BASE_URL", "https://cloud.comfy.org")
client = Comfy(api_key=api_key)
workflow = client.workflows.from_json({
"92": {
"class_type": "LoadImage",
"inputs": {
"image": "UPLOADED_image_FILENAME"
},
"_meta": {
"title": "Load Image"
}
},
"96": {
"class_type": "ImageCompare",
"inputs": {
"compare_view": None,
"image_a": [
"92",
0
],
"image_b": [
"85:39",
0
]
},
"_meta": {
"title": "Compare Images"
}
},
"97": {
"class_type": "SaveImage",
"inputs": {
"filename_prefix": "upscaled_by_supir",
"images": [
"85:39",
0
]
},
"_meta": {
"title": "Save Image"
}
},
"85:1": {
"class_type": "CheckpointLoaderSimple",
"inputs": {
"ckpt_name": "juggernautXL_v9Rdphoto2Lightning.safetensors"
},
"_meta": {
"title": "Load Checkpoint"
}
},
"85:11": {
"class_type": "VAEDecode",
"inputs": {
"samples": [
"85:20",
0
],
"vae": [
"85:1",
2
]
},
"_meta": {
"title": "VAE Decode"
}
},
"85:20": {
"class_type": "SamplerCustom",
"inputs": {
"add_noise": True,
"cfg": 1.5,
"latent_image": [
"85:57",
0
],
"model": [
"85:62",
0
],
"negative": [
"85:60",
0
],
"noise_seed": 402244474214267,
"positive": [
"85:59",
0
],
"sampler": [
"85:76",
0
],
"sigmas": [
"85:29",
0
]
},
"_meta": {
"title": "SamplerCustom"
}
},
"85:29": {
"class_type": "BasicScheduler",
"inputs": {
"denoise": 1,
"model": [
"85:62",
0
],
"scheduler": "sgm_uniform",
"steps": 10
},
"_meta": {
"title": "BasicScheduler"
}
},
"85:3": {
"class_type": "ModelPatchLoader",
"inputs": {
"name": "SUPIR-v0Q_fp16.safetensors"
},
"_meta": {
"title": "Load Model Patch"
}
},
"85:39": {
"class_type": "ColorTransfer",
"inputs": {
"image_ref": [
"85:94",
0
],
"image_target": [
"85:11",
0
],
"method": "mkl_lab",
"source_stats": "per_frame",
"strength": 1
},
"_meta": {
"title": "Transfer Color"
}
},
"85:57": {
"class_type": "EmptyLatentImage",
"inputs": {
"batch_size": 1,
"height": [
"85:58",
1
],
"width": [
"85:58",
0
]
},
"_meta": {
"title": "Empty Latent Image"
}
},
"85:58": {
"class_type": "GetImageSize",
"inputs": {
"image": [
"85:94",
0
]
},
"_meta": {
"title": "Get Image Size"
}
},
"85:59": {
"class_type": "CLIPTextEncodeSDXL",
"inputs": {
"clip": [
"85:1",
1
],
"crop_h": 0,
"crop_w": 0,
"height": 1024,
"target_height": 1024,
"target_width": 1024,
"text_g": [
"85:88",
0
],
"text_l": [
"85:88",
0
],
"width": 1024
},
"_meta": {
"title": "CLIP Text Encode (SDXL)"
}
},
"85:60": {
"class_type": "CLIPTextEncodeSDXL",
"inputs": {
"clip": [
"85:1",
1
],
"crop_h": 0,
"crop_w": 0,
"height": 1024,
"target_height": 1024,
"target_width": 1024,
"text_g": [
"85:73",
0
],
"text_l": [
"85:73",
0
],
"width": 1024
},
"_meta": {
"title": "CLIP Text Encode (SDXL)"
}
},
"85:62": {
"class_type": "SUPIRApply",
"inputs": {
"image": [
"85:94",
0
],
"model": [
"85:1",
0
],
"model_patch": [
"85:3",
0
],
"restore_cfg": 4,
"restore_cfg_s_tmin": 0.05,
"strength_end": 0.9,
"strength_start": 1,
"vae": [
"85:1",
2
]
},
"_meta": {
"title": "SUPIRApply"
}
},
"85:71": {
"class_type": "PrimitiveStringMultiline",
"inputs": {
"value": "`A herd of wild horses gallops at night through a neon-lit city street, motion blur conveying raw energy against the urban glow.`"
},
"_meta": {
"title": "Text (Multiline)"
}
},
"85:73": {
"class_type": "PrimitiveStringMultiline",
"inputs": {
"value": "painting, oil painting, illustration, drawing, art, sketch, cartoon, CG Style, 3D render, unreal engine, blurring, dirty, messy, worst quality, low quality, frames, watermark, signature, jpeg artifacts, deformed, lowres, over-smooth bad quality, blurry, messy"
},
"_meta": {
"title": "Text (Multiline)"
}
},
"85:76": {
"class_type": "KSamplerSelect",
"inputs": {
"sampler_name": "dpmpp_2m_sde"
},
"_meta": {
"title": "KSamplerSelect"
}
},
"85:86": {
"class_type": "CLIPLoader",
"inputs": {
"clip_name": "qwen3.5_4b_bf16.safetensors",
"device": "default",
"type": "stable_diffusion"
},
"_meta": {
"title": "Load CLIP"
}
},
"85:87": {
"class_type": "TextGenerate",
"inputs": {
"clip": [
"85:86",
0
],
"image": [
"92",
0
],
"max_length": 2048,
"mtp": "auto",
"prompt": [
"85:91",
0
],
"sampling_mode": "on",
"sampling_mode.min_p": 0.05,
"sampling_mode.presence_penalty": 0,
"sampling_mode.repetition_penalty": 1.05,
"sampling_mode.seed": 0,
"sampling_mode.temperature": 0.7,
"sampling_mode.top_k": 64,
"sampling_mode.top_p": 0.95,
"thinking": False,
"use_default_template": True
},
"_meta": {
"title": "Generate Text (DEPRECATED)"
}
},
"85:88": {
"class_type": "ComfySwitchNode",
"inputs": {
"on_false": [
"85:71",
0
],
"on_true": [
"85:87",
0
],
"switch": [
"85:90",
0
]
},
"_meta": {
"title": "If/Else Switch"
}
},
"85:89": {
"class_type": "PreviewAny",
"inputs": {
"source": [
"85:88",
0
]
},
"_meta": {
"title": "Preview as Text"
}
},
"85:90": {
"class_type": "BOOLConstant",
"inputs": {
"value": True
},
"_meta": {
"title": "enable_image_captioning"
}
},
"85:91": {
"class_type": "StringConcatenate",
"inputs": {
"delimiter": "",
"string_a": "Describe the scene concisely in English, using vivid, descriptive keywords and phrases suitable for AI image generation (SDXL). Focus only on visual elements, composition, lighting, style, and atmosphere. Do not include extra explanations or instructions.",
"string_b": [
"85:71",
0
]
},
"_meta": {
"title": "Concatenate Text"
}
},
"85:94": {
"class_type": "ResizeImageMaskNode",
"inputs": {
"input": [
"92",
0
],
"resize_type": "scale total pixels",
"resize_type.megapixels": 2.25,
"scale_method": "lanczos"
},
"_meta": {
"title": "Resize Image/Mask"
}
}
})
# Replace each example.com URL with a public URL of your file.
workflow.set_input("92", "image", client.assets.from_url("https://example.com/replace-with-a-url/image"))
# run() also passes api_key to the partner nodes in this workflow.
job = client.run(workflow, api_key=api_key)
for output in job.get_outputs("97"):
output.to_file(output.name)About this workflow
SUPIR restores rather than merely enlarges: it re-synthesises detail the source lost, guided by a prompt, then colour-transfers the result back onto the original so the grade survives. The shipped case is a night-time neon street of horses, described by the prompt and lifted to about 2.3 megapixels at the same framing.
Graph: LoadImage -> ResizeImageMaskNode (scale total pixels to 2.25 MP) -> SUPIRApply (SUPIR-v0Q_fp16, strength 1 -> 0.9, restore_cfg 4) -> SamplerCustom (dpmpp_2m_sde, sgm_uniform, 10 steps, cfg 1.5) -> VAEDecode -> ColorTransfer (mkl_lab, per frame) -> SaveImage. A caption branch feeds the prompt: a Qwen 3.5 4B TextGenerate describes the image, and a switch (on by default) chooses that over the hand-written prompt in the PrimitiveStringMultiline.
Runs on open weights in the cloud worker; no partner API.
Related workflows
- Nano Banana Pro, Gemini3 Pro Image Preview, Google
Create a character turnaround
- Qwen-Image-Edit
Change a material
- Qwen-Image-Edit
See your subject from a new angle
- Flux.2 Dev, Flux
Create a product mockup
- Nano Banana Pro
Try an outfit on a character
- Seedream
Put your product in a new scene
- SSeedVR2
Upscale and restore detail
- Nano Banana Pro
Sharpen a product photo
- Topaz
Upscale an illustration
- HHitPaw
Restore portrait detail
- FLUX.1 Fill
Edit a selected region
- FLUX.1 Fill
Extend an image’s borders