舊照片修復
本應用可增強你的舊照片。只需上傳圖像,即可在數秒內修復褪色或受損照片。
工作流程內部
來源範本的唯讀預覽。請在 Cloud 中開啟,以探索節點並進行變更。
從您的程式碼呼叫此模型
以下請求使用與 Playground 相同的已準備節點圖和設定。每次提交都可能啟動付費執行;若提交結果不明,請勿自動重試提交。
What you need
- Runs on
- Comfy Cloud
- 金鑰
- COMFY_API_KEY
- 您的檔案
- 由程式碼透過其 URL 上傳
需要付費 Cloud 方案與點數。
# 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({
"76": {
"class_type": "LoadImage",
"inputs": {
"image": "UPLOADED_image_FILENAME"
},
"_meta": {
"title": "Load Image"
}
},
"156": {
"class_type": "SaveImage",
"inputs": {
"filename_prefix": "photo_restoration",
"images": [
"158:154",
0
]
},
"_meta": {
"title": "Save Image"
}
},
"157": {
"class_type": "ImageCompare",
"inputs": {
"compare_view": {
"__value__": [
"",
""
]
},
"image_a": [
"156",
0
],
"image_b": [
"76",
0
]
},
"_meta": {
"title": "Compare Images"
}
},
"185": {
"class_type": "PrimitiveStringMultiline",
"inputs": {
"value": "Restore this old photograph. Remove all scratches, dust, creases, tears, and stains. Repair faded and damaged areas. Enhance sharpness and fine detail while preserving the original faces, expressions, clothing, and background exactly as they are. Do not change the identity of any person, the composition, or add or remove any objects. High-quality photo restoration."
},
"_meta": {
"title": "Restore Prompt"
}
},
"186": {
"class_type": "PrimitiveStringMultiline",
"inputs": {
"value": "Restore this old photograph of four travelers standing on a rocky shoreline. Remove every crease, fold line, tear, water stain, mildew spot, scratch and speck of dust, and rebuild the missing torn corner so the rocks, grass and sky continue naturally. Repair the faded areas and recover detail in the knitted sweaters, oilcloth coats, boots and the faces. Keep every person's identity, expression, pose and position exactly as they are, and keep the shoreline, the sea spray and the composition unchanged. Colorize it with realistic, period-appropriate colors: weathered skin tones, undyed cream and charcoal wool, dark olive oilcloth, wet slate rocks, grey-green sea grass and a pale overcast sky over grey-blue water. The result should look like a well-preserved color photograph from the era, not a modern image."
},
"_meta": {
"title": "Restore + Colorize Prompt"
}
},
"187": {
"class_type": "ComfySwitchNode",
"inputs": {
"on_false": [
"185",
0
],
"on_true": [
"186",
0
],
"switch": True
},
"_meta": {
"title": "Enhanced Color Restoration"
}
},
"188": {
"class_type": "PreviewAny",
"inputs": {
"source": [
"187",
0
]
},
"_meta": {
"title": "Final Prompt Preview"
}
},
"158:133": {
"class_type": "ModelSamplingAuraFlow",
"inputs": {
"model": [
"158:145",
0
],
"sampling": "flow",
"shift": 3.1
},
"_meta": {
"title": "ModelSamplingAuraFlow"
}
},
"158:134": {
"class_type": "VAELoader",
"inputs": {
"vae_name": "qwen_image_vae.safetensors"
},
"_meta": {
"title": "Load VAE"
}
},
"158:135": {
"class_type": "FluxKontextMultiReferenceLatentMethod",
"inputs": {
"conditioning": [
"158:137",
0
],
"reference_latents_method": "index_timestep_zero"
},
"_meta": {
"title": "Edit Model Reference Method"
}
},
"158:136": {
"class_type": "FluxKontextMultiReferenceLatentMethod",
"inputs": {
"conditioning": [
"158:139",
0
],
"reference_latents_method": "index_timestep_zero"
},
"_meta": {
"title": "Edit Model Reference Method"
}
},
"158:137": {
"class_type": "TextEncodeQwenImageEditPlus",
"inputs": {
"clip": [
"158:146",
0
],
"image1": [
"158:155",
0
],
"prompt": "",
"vae": [
"158:134",
0
]
},
"_meta": {
"title": "Text Encode Qwen Image Edit Plus"
}
},
"158:139": {
"class_type": "TextEncodeQwenImageEditPlus",
"inputs": {
"clip": [
"158:146",
0
],
"image1": [
"158:155",
0
],
"prompt": [
"188",
0
],
"vae": [
"158:134",
0
]
},
"_meta": {
"title": "TextEncodeQwenImageEditPlus (Positive)"
}
},
"158:140": {
"class_type": "CFGNorm",
"inputs": {
"model": [
"158:133",
0
],
"pre_cfg": False,
"strength": 1
},
"_meta": {
"title": "CFGNorm"
}
},
"158:141": {
"class_type": "LoraLoaderModelOnly",
"inputs": {
"lora_name": "Qwen-Image-Edit-2511-Lightning-4steps-V1.0-bf16.safetensors",
"model": [
"158:140",
0
],
"strength_model": 1
},
"_meta": {
"title": "Load LoRA"
}
},
"158:142": {
"class_type": "PrimitiveFloat",
"inputs": {
"value": 4
},
"_meta": {
"title": "CFG"
}
},
"158:143": {
"class_type": "PrimitiveFloat",
"inputs": {
"value": 1
},
"_meta": {
"title": "CFG"
}
},
"158:144": {
"class_type": "VAEEncode",
"inputs": {
"pixels": [
"158:155",
0
],
"vae": [
"158:134",
0
]
},
"_meta": {
"title": "VAE Encode"
}
},
"158:145": {
"class_type": "UNETLoader",
"inputs": {
"unet_name": "qwen_image_edit_2511_fp8mixed.safetensors",
"weight_dtype": "default"
},
"_meta": {
"title": "Load Diffusion Model"
}
},
"158:146": {
"class_type": "CLIPLoader",
"inputs": {
"clip_name": "qwen_2.5_vl_7b_fp8_scaled.safetensors",
"device": "default",
"type": "qwen_image"
},
"_meta": {
"title": "Load CLIP"
}
},
"158:147": {
"class_type": "ComfySwitchNode",
"inputs": {
"on_false": [
"158:140",
0
],
"on_true": [
"158:141",
0
],
"switch": [
"158:150",
0
]
},
"_meta": {
"title": "Switch (Model)"
}
},
"158:148": {
"class_type": "PrimitiveInt",
"inputs": {
"value": 4
},
"_meta": {
"title": "Steps"
}
},
"158:149": {
"class_type": "PrimitiveInt",
"inputs": {
"value": 40
},
"_meta": {
"title": "Steps"
}
},
"158:150": {
"class_type": "PrimitiveBoolean",
"inputs": {
"value": True
},
"_meta": {
"title": "Enable 4steps LoRA?"
}
},
"158:151": {
"class_type": "ComfySwitchNode",
"inputs": {
"on_false": [
"158:142",
0
],
"on_true": [
"158:143",
0
],
"switch": [
"158:150",
0
]
},
"_meta": {
"title": "Switch (CFG)"
}
},
"158:152": {
"class_type": "ComfySwitchNode",
"inputs": {
"on_false": [
"158:149",
0
],
"on_true": [
"158:148",
0
],
"switch": [
"158:150",
0
]
},
"_meta": {
"title": "Switch (Steps)"
}
},
"158:153": {
"class_type": "KSampler",
"inputs": {
"cfg": [
"158:151",
0
],
"denoise": 1,
"latent_image": [
"158:144",
0
],
"model": [
"158:147",
0
],
"negative": [
"158:135",
0
],
"positive": [
"158:136",
0
],
"sampler_name": "euler",
"scheduler": "simple",
"seed": 179526350171703,
"steps": [
"158:152",
0
]
},
"_meta": {
"title": "KSampler"
}
},
"158:154": {
"class_type": "VAEDecode",
"inputs": {
"samples": [
"158:153",
0
],
"vae": [
"158:134",
0
]
},
"_meta": {
"title": "VAE Decode"
}
},
"158:155": {
"class_type": "FluxKontextImageScale",
"inputs": {
"image": [
"76",
0
]
},
"_meta": {
"title": "FluxKontextImageScale"
}
}
})
workflow.set_input("76", "image", client.assets.from_url("https://comfy.org/catalog-media/36b7be97-9ae9-45b4-a1b5-755305cdca6a/35f22ae6-ca98-43bb-86cf-a4734fc1b43a"))
# 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("156"):
output.to_file(output.name)試試範例
關於此工作流程
「舊照片修復」是專為修復褪色、刮痕或低對比圖像設計的 ComfyUI 工作流程,讓你無需猜測即可還原影像。流程結合實用節點與專屬修復階段,讓你能預覽、比較並自信地匯出成果。流程從 LoadImage 開始,經過自訂修復運算節點(ID 4c000cf8-4ec4-49a6-853c-e78dd316edc6),並透過 ComfySwitchNode 實現原圖與修復圖即時切換。
技術上,原始與處理後圖像會送入 ImageCompare 進行並排比較,PreviewAny 則可在畫布上快速檢查。PrimitiveStringMultiline 節點可直接在圖中記錄多行備註(如設定或變更紀錄),SaveImage 負責將最終選擇寫入磁碟。此流程強調 A/B 驗證與可重現性:調整修復節點參數(依自訂節點提供的控制項),用開關判斷效果,ImageCompare 驗證後再匯出滿意結果。
問答
它是此工作流程的專用修復階段。依其實作與可調參數不同,通常會進行去雜訊、對比與色彩還原、瑕疵降低等處理。請打開節點查看你安裝版本提供哪些控制項。
建議使用 GPU 以加快速度並更順暢迭代。有些環境可用 CPU 執行,但處理會明顯變慢。若預覽很慢,可先降低解析度測試,最後再切回全尺寸輸出。
可以。先將 ComfySwitchNode 切到修復分支並執行一次、用 SaveImage 儲存;再把開關切到原圖分支並再執行一次即可儲存原圖版本。ImageCompare 用於評估;實際檔案輸出由 SaveImage 負責。
不包含。它著重在輸入原始解析度下的修復。若需要放大,可在修復階段後加入放大節點,另做一個工作流程或修改此節點圖。
相關工作流程
- 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