2.3 Creator:影像放大與分析
學習如何使用 Z Image Turbo 放大影像並自動產生提示詞。
關於
這個名為「2.3 Creator:影像放大與分析」的 ComfyUI 工作流程,設計用於提升影像解析度,同時利用 Z Image Turbo 模型從影像自動產生詳細提示詞。此流程結合了多個節點,包括 LoadImage、SaveImage 及 Florence2Run,有效地放大影像並分析其內容。Florence2Run 節點運用 Florence-2 多模態模型,從影像中提取物件屬性、空間關係及場景脈絡等詳細資訊,進而生成完整的提示詞。這種雙重方式不僅提升影像視覺品質,也豐富了相關中繼資料,特別適合需要高品質視覺與詳細描述資料的應用場景。
放大過程採用擴散技術,透過加入去雜訊像素來提升影像解析度,同時保留原始內容與結構並增強清晰度。此流程在 Z Image Turbo 模型中使用低去雜訊值,確保放大後的影像能保有原始細節。這使其成為數位藝術、攝影及媒體製作等對影像品質要求極高的應用的理想工具。結合影像放大與自動分析,此流程為提升與理解視覺內容提供了完整解決方案。
您提供的內容
- 正在讀取工作流程
在 ComfyUI 中執行。 此工作流程無法在此頁面上執行。請在已載入所有內容的 Comfy Cloud 中開啟,或下載到您自己的 ComfyUI。
在 Cloud 中試用此工作流程尚無範例輸出。
工作流程內部
節點圖的唯讀預覽。請在 Comfy Cloud 中開啟,或下載後編輯節點。
Loading the graph
Open full-size workflow preview從程式碼使用此工作流程
可行時會根據工作流程圖和輸入內容產生;否則會顯示儲存的範例。執行可能產生費用的程式碼前,請檢查認證資訊和端點。
What you need
- Runs on
- Comfy Cloud
- 金鑰
- COMFY_API_KEY
需要付費 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({
"132": {
"class_type": "LoadImage",
"inputs": {
"image": "dragon_fruit_cream.png"
},
"_meta": {
"title": "Load Image"
}
},
"143": {
"class_type": "SaveImage",
"inputs": {
"filename_prefix": "ComfyUI",
"images": [
"162:65",
0
]
},
"_meta": {
"title": "Save Image"
}
},
"149": {
"class_type": "Florence2Run",
"inputs": {
"do_sample": True,
"fill_mask": True,
"florence2_model": [
"150",
0
],
"image": [
"132",
0
],
"keep_model_loaded": False,
"max_new_tokens": 1024,
"num_beams": 3,
"output_mask_select": "",
"seed": 1093475924089169,
"task": "more_detailed_caption",
"text_input": ""
},
"_meta": {
"title": "Florence2Run"
}
},
"150": {
"class_type": "DownloadAndLoadFlorence2Model",
"inputs": {
"attention": "sdpa",
"convert_to_safetensors": False,
"model": "MiaoshouAI/Florence-2-large-PromptGen-v2.0",
"precision": "fp16"
},
"_meta": {
"title": "DownloadAndLoadFlorence2Model"
}
},
"157": {
"class_type": "PreviewAny",
"inputs": {
"source": [
"149",
2
]
},
"_meta": {
"title": "Preview as Text"
}
},
"158": {
"class_type": "ImageCompare",
"inputs": {
"compare_view": {
"__value__": [
"",
""
]
},
"image_a": [
"162:65",
0
],
"image_b": [
"132",
0
]
},
"_meta": {
"title": "Compare Images"
}
},
"162:164": {
"class_type": "ImageScaleToMaxDimension",
"inputs": {
"image": [
"132",
0
],
"largest_size": 2048,
"upscale_method": "lanczos"
},
"_meta": {
"title": "Scale Image to Max Dimension"
}
},
"162:62": {
"class_type": "CLIPLoader",
"inputs": {
"clip_name": "qwen_3_4b.safetensors",
"device": "default",
"type": "lumina2"
},
"_meta": {
"title": "Load CLIP"
}
},
"162:63": {
"class_type": "VAELoader",
"inputs": {
"vae_name": "ae.safetensors"
},
"_meta": {
"title": "Load VAE"
}
},
"162:65": {
"class_type": "VAEDecode",
"inputs": {
"samples": [
"162:69",
0
],
"vae": [
"162:63",
0
]
},
"_meta": {
"title": "VAE Decode"
}
},
"162:66": {
"class_type": "UNETLoader",
"inputs": {
"unet_name": "z_image_turbo_bf16.safetensors",
"weight_dtype": "default"
},
"_meta": {
"title": "Load Diffusion Model"
}
},
"162:67": {
"class_type": "CLIPTextEncode",
"inputs": {
"clip": [
"162:62",
0
],
"text": "masterpiece, 8k"
},
"_meta": {
"title": "CLIP Text Encode (Positive Prompt)"
}
},
"162:69": {
"class_type": "KSampler",
"inputs": {
"cfg": 1,
"denoise": 0.33,
"latent_image": [
"162:80",
0
],
"model": [
"162:70",
0
],
"negative": [
"162:71",
0
],
"positive": [
"162:67",
0
],
"sampler_name": "dpmpp_2m_sde",
"scheduler": "beta",
"seed": 344777149081245,
"steps": 5
},
"_meta": {
"title": "KSampler"
}
},
"162:70": {
"class_type": "ModelSamplingAuraFlow",
"inputs": {
"model": [
"162:66",
0
],
"sampling": "flow",
"shift": 3
},
"_meta": {
"title": "ModelSamplingAuraFlow"
}
},
"162:71": {
"class_type": "CLIPTextEncode",
"inputs": {
"clip": [
"162:62",
0
],
"text": ""
},
"_meta": {
"title": "CLIP Text Encode (Negative Prompt)"
}
},
"162:76": {
"class_type": "UpscaleModelLoader",
"inputs": {
"model_name": "RealESRGAN_x4plus.safetensors"
},
"_meta": {
"title": "Load Upscale Model"
}
},
"162:79": {
"class_type": "ImageUpscaleWithModel",
"inputs": {
"image": [
"162:164",
0
],
"upscale_model": [
"162:76",
0
]
},
"_meta": {
"title": "Upscale Image (using Model)"
}
},
"162:80": {
"class_type": "VAEEncode",
"inputs": {
"pixels": [
"162:81",
0
],
"vae": [
"162:63",
0
]
},
"_meta": {
"title": "VAE Encode"
}
},
"162:81": {
"class_type": "ImageScaleBy",
"inputs": {
"image": [
"162:79",
0
],
"scale_by": 0.5,
"upscale_method": "lanczos"
},
"_meta": {
"title": "Upscale Image By"
}
}
})
# run() also passes api_key to the partner nodes in this workflow.
job = client.run(workflow, api_key=api_key)問答
Florence2Run 節點利用 Florence-2 多模態模型分析影像並產生詳細提示詞,涵蓋物件屬性、空間關係與場景脈絡。
放大過程採用 Z Image Turbo 模型的擴散技術與低去雜訊值,提升影像解析度並保留原始細節。
可以,此流程相當多元,適用於數位藝術、攝影等各類型影像的放大與分析。
建議將去雜訊值設定在 0.2 至 0.35 之間,以確保放大後的影像保有原始細節與清晰度。