Qwen-Image-Layered 圖層分解
將圖像分解為可編輯的RGBA圖層,以便使用Qwen千問-圖像分層進行高保真度的重新著色、替換、調整大小和重新定位工作流程。
關於
Qwen-Image-Layered 分層分解工作流程,專為將圖像分解為可編輯的 RGBA 圖層而設計,讓高保真圖像操作成為可能。此流程利用 Qwen-Image-Layered 模型,將圖像拆解為獨立圖層,每層包含紅、綠、藍與 Alpha 通道。這種分解方式讓你能精確控制每個圖層,可針對圖像中的元素進行重上色、替換、縮放或重新定位,而不影響整體構圖。技術上,流程會用 SaveImage 與 LoadImage 節點處理圖像檔案,ImageScaleToMaxDimension 節點則確保圖像以最佳解析度處理。f754a936-daaf-4b6e-9658-41fdc54d301d 與 1ea4fa01-a81b-4420-a03c-f60019e69a92 等節點則負責複雜的圖像資料轉換,協助分解過程。
您提供的內容
- 正在讀取工作流程
在 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({
"60": {
"class_type": "SaveImage",
"inputs": {
"filename_prefix": "Qwen-image-layers",
"images": [
"83:8",
0
]
},
"_meta": {
"title": "Save Image"
}
},
"74": {
"class_type": "LoadImage",
"inputs": {
"image": "coastal_smiling_woman.png"
},
"_meta": {
"title": "Load Image"
}
},
"82": {
"class_type": "ImageScaleToMaxDimension",
"inputs": {
"image": [
"74",
0
],
"largest_size": 640,
"upscale_method": "lanczos"
},
"_meta": {
"title": "Scale Image to Max Dimension"
}
},
"116": {
"class_type": "PrimitiveStringMultiline",
"inputs": {
"value": "A cinematic medium shot of a beautiful young woman with fair skin and a joyful, radiant smile, looking back over her shoulder. She has voluminous, curly auburn hair styled in a loose, windblown updo. She is standing on a rugged, rocky coastline overlooking a sun-drenched ocean. She wears a vintage, long-sleeved, high-collared dress in an off-white, crinkled fabric with delicate smocking on the bodice and a simple brown sash at her waist. In the background, the ocean sparkles brightly under the sun, and a majestic tall ship with full sails is visible in the distance. The scene is illuminated by the warm, golden light of the late afternoon, creating a soft, romantic, and nostalgic atmosphere with a shallow depth of field that keeps the woman in sharp focus."
},
"_meta": {
"title": "Prompt"
}
},
"83:3": {
"class_type": "KSampler",
"inputs": {
"cfg": 2.5,
"denoise": 1,
"latent_image": [
"83:83",
0
],
"model": [
"83:66",
0
],
"negative": [
"83:70",
0
],
"positive": [
"83:69",
0
],
"sampler_name": "euler",
"scheduler": "simple",
"seed": 657641993490688,
"steps": 20
},
"_meta": {
"title": "KSampler"
}
},
"83:37": {
"class_type": "UNETLoader",
"inputs": {
"unet_name": "qwen_image_layered_bf16.safetensors",
"weight_dtype": "default"
},
"_meta": {
"title": "Load Diffusion Model"
}
},
"83:38": {
"class_type": "CLIPLoader",
"inputs": {
"clip_name": "qwen_2.5_vl_7b_fp8_scaled.safetensors",
"device": "default",
"type": "qwen_image"
},
"_meta": {
"title": "Load CLIP"
}
},
"83:39": {
"class_type": "VAELoader",
"inputs": {
"vae_name": "qwen_image_layered_vae.safetensors"
},
"_meta": {
"title": "Load VAE"
}
},
"83:6": {
"class_type": "CLIPTextEncode",
"inputs": {
"clip": [
"83:38",
0
],
"text": [
"116",
0
]
},
"_meta": {
"title": "CLIP Text Encode (Positive Prompt)"
}
},
"83:66": {
"class_type": "ModelSamplingAuraFlow",
"inputs": {
"model": [
"83:37",
0
],
"sampling": "flow",
"shift": 1
},
"_meta": {
"title": "ModelSamplingAuraFlow"
}
},
"83:69": {
"class_type": "ReferenceLatent",
"inputs": {
"conditioning": [
"83:6",
0
],
"latent": [
"83:71",
0
]
},
"_meta": {
"title": "Set Reference Latent"
}
},
"83:7": {
"class_type": "CLIPTextEncode",
"inputs": {
"clip": [
"83:38",
0
],
"text": ""
},
"_meta": {
"title": "CLIP Text Encode (Negative Prompt)"
}
},
"83:70": {
"class_type": "ReferenceLatent",
"inputs": {
"conditioning": [
"83:7",
0
],
"latent": [
"83:71",
0
]
},
"_meta": {
"title": "Set Reference Latent"
}
},
"83:71": {
"class_type": "VAEEncode",
"inputs": {
"pixels": [
"82",
0
],
"vae": [
"83:39",
0
]
},
"_meta": {
"title": "VAE Encode"
}
},
"83:76": {
"class_type": "LatentCutToBatch",
"inputs": {
"dim": "t",
"samples": [
"83:3",
0
],
"slice_size": 1
},
"_meta": {
"title": "LatentCutToBatch"
}
},
"83:78": {
"class_type": "GetImageSize",
"inputs": {
"image": [
"82",
0
]
},
"_meta": {
"title": "Get Image Size"
}
},
"83:8": {
"class_type": "VAEDecode",
"inputs": {
"samples": [
"83:76",
0
],
"vae": [
"83:39",
0
]
},
"_meta": {
"title": "VAE Decode"
}
},
"83:83": {
"class_type": "EmptyQwenImageLayeredLatentImage",
"inputs": {
"batch_size": 1,
"height": [
"83:78",
1
],
"layers": 2,
"width": [
"83:78",
0
]
},
"_meta": {
"title": "Empty Qwen Image Layered Latent"
}
}
})
# run() also passes api_key to the partner nodes in this workflow.
job = client.run(workflow, api_key=api_key)問答
標準處理建議 640px,高解析度建議 1024px。
可以,每個圖層都可獨立編輯,能調整顏色、尺寸與位置,不影響其他圖層。
ImageScaleToMaxDimension 節點會將圖像調整至最佳尺寸,兼顧品質與效能。
適合。流程設計簡單,步驟明確,節點操作直觀,適合各種程度的使用者。