FLUX.2 Klein 9B:圖像擴充
使用FLUX.2 Klein 9B模型智慧擴充和展開圖像內容。輸入圖像以產生無縫擴圖和擴充構圖。
工作流程內部
來源範本的唯讀預覽。請在 Cloud 中開啟,以探索節點並進行變更。
Loading the graph
Open full-size workflow preview此工作流程中的檔案
- 輸出
- 圖片
- 作者
- ComfyUI
從您的程式碼呼叫此模型
以下請求使用與 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({
"133": {
"class_type": "SamplerCustomAdvanced",
"inputs": {
"guider": [
"136",
0
],
"latent_image": [
"139",
0
],
"noise": [
"135",
0
],
"sampler": [
"137",
0
],
"sigmas": [
"138",
0
]
},
"_meta": {
"title": "SamplerCustomAdvanced"
}
},
"134": {
"class_type": "CLIPLoader",
"inputs": {
"clip_name": "qwen_3_8b.safetensors",
"device": "default",
"type": "flux2"
},
"_meta": {
"title": "Load CLIP"
}
},
"135": {
"class_type": "RandomNoise",
"inputs": {
"noise_seed": 754163315896983
},
"_meta": {
"title": "RandomNoise"
}
},
"136": {
"class_type": "CFGGuider",
"inputs": {
"cfg": 1,
"model": [
"158",
0
],
"negative": [
"149",
0
],
"positive": [
"148",
0
]
},
"_meta": {
"title": "CFG Guider"
}
},
"137": {
"class_type": "KSamplerSelect",
"inputs": {
"sampler_name": "euler"
},
"_meta": {
"title": "KSamplerSelect"
}
},
"138": {
"class_type": "Flux2Scheduler",
"inputs": {
"height": [
"143",
1
],
"steps": 4,
"width": [
"143",
0
]
},
"_meta": {
"title": "Flux2Scheduler"
}
},
"139": {
"class_type": "EmptyFlux2LatentImage",
"inputs": {
"batch_size": 1,
"height": [
"143",
1
],
"width": [
"143",
0
]
},
"_meta": {
"title": "Empty Flux 2 Latent"
}
},
"140": {
"class_type": "VAEDecode",
"inputs": {
"samples": [
"133",
0
],
"vae": [
"161",
0
]
},
"_meta": {
"title": "VAE Decode"
}
},
"142": {
"class_type": "SaveImage",
"inputs": {
"filename_prefix": "Flux2-Klein",
"images": [
"167",
0
]
},
"_meta": {
"title": "Save Image"
}
},
"143": {
"class_type": "GetImageSize",
"inputs": {
"image": [
"165",
0
]
},
"_meta": {
"title": "Get Image Size"
}
},
"144": {
"class_type": "ConditioningZeroOut",
"inputs": {
"conditioning": [
"157",
0
]
},
"_meta": {
"title": "Conditioning Zero Out"
}
},
"145": {
"class_type": "VAEEncode",
"inputs": {
"pixels": [
"165",
0
],
"vae": [
"161",
0
]
},
"_meta": {
"title": "VAE Encode"
}
},
"147": {
"class_type": "ImageScaleToTotalPixels",
"inputs": {
"image": [
"159",
0
],
"megapixels": 1.5000000000000002,
"resolution_steps": 1,
"upscale_method": "nearest-exact"
},
"_meta": {
"title": "Scale Image to Total Pixels"
}
},
"148": {
"class_type": "ReferenceLatent",
"inputs": {
"conditioning": [
"157",
0
],
"latent": [
"145",
0
]
},
"_meta": {
"title": "Set Reference Latent"
}
},
"149": {
"class_type": "ReferenceLatent",
"inputs": {
"conditioning": [
"144",
0
],
"latent": [
"145",
0
]
},
"_meta": {
"title": "Set Reference Latent"
}
},
"157": {
"class_type": "CLIPTextEncode",
"inputs": {
"clip": [
"134",
0
],
"text": "Remove the green areas by extending the scene into them seamlessly. Continue the flooded Victorian conservatory on both sides: more cast-iron columns with weathered verdigris, hanging ferns and curtains of moss, tiered glass terrariums, pale water lilies and drifting paper folios on the still water, and golden shafts of light falling through the broken glass roof. Match the perspective, the warm morning light, the soft haze and the celadon, bronze and parchment palette of the original exactly. Keep the seated naturalist and everything already in the picture unchanged, with no visible seam, border or repeated pattern."
},
"_meta": {
"title": "CLIP Text Encode (Positive Prompt)"
}
},
"158": {
"class_type": "UNETLoader",
"inputs": {
"unet_name": "flux-2-klein-9b.safetensors",
"weight_dtype": "default"
},
"_meta": {
"title": "Load Diffusion Model"
}
},
"159": {
"class_type": "LoadImage",
"inputs": {
"image": "UPLOADED_image_FILENAME"
},
"_meta": {
"title": "Load Image"
}
},
"161": {
"class_type": "VAELoader",
"inputs": {
"vae_name": "flux2-vae.safetensors"
},
"_meta": {
"title": "Load VAE"
}
},
"164": {
"class_type": "ImagePadForOutpaint",
"inputs": {
"bottom": 0,
"feathering": 40,
"image": [
"147",
0
],
"left": 480,
"right": 480,
"top": 0
},
"_meta": {
"title": "Pad Image for Outpainting"
}
},
"165": {
"class_type": "ImageScaleToTotalPixels",
"inputs": {
"image": [
"166",
0
],
"megapixels": 1.0000000000000002,
"resolution_steps": 1,
"upscale_method": "nearest-exact"
},
"_meta": {
"title": "Scale Image to Total Pixels"
}
},
"166": {
"class_type": "DrawMaskOnImage",
"inputs": {
"color": "0, 255, 0",
"device": "cpu",
"image": [
"164",
0
],
"mask": [
"164",
1
]
},
"_meta": {
"title": "Draw Mask On Image"
}
},
"167": {
"class_type": "ColorMatch",
"inputs": {
"image_ref": [
"159",
0
],
"image_target": [
"140",
0
],
"method": "mkl",
"multithread": True,
"strength": 1
},
"_meta": {
"title": "Color Match"
}
},
"303": {
"class_type": "ImageCompare",
"inputs": {
"compare_view": {
"__value__": [
"",
""
]
},
"image_a": [
"165",
0
],
"image_b": [
"167",
0
]
},
"_meta": {
"title": "Compare Images"
}
}
})
workflow.set_input("159", "image", client.assets.from_url("https://comfy.org/catalog-media/6dadb3e5-93c6-4512-9aac-01481e9a3c7d/4c74a3e3-fb61-488f-a711-8173c8310920"))
# 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("142"):
output.to_file(output.name)試試範例
關於此工作流程
「FLUX.2 Klein 9B:圖像擴展」工作流程專為利用 FLUX.2 Klein 9B 模型擴展與增強圖像而設計。此流程擅長外延(outpainting),即在維持原始風格與內容下,延伸圖像邊界。流程結合 SamplerCustomAdvanced、CLIPLoader、RandomNoise 等進階節點,產生無縫延伸的圖像。透過 ComfyUI-Color-Matcher 與 comfyui-kjnodes,確保色彩一致與風格連貫,特別適合藝術家與設計師將有限素材擴展為大幅構圖。
技術上,流程先用 LoadImage 載入圖像,經 VAEEncode 節點編碼至潛在空間,再用 ImagePadForOutpaint 節點擴展畫布。Flux2Scheduler 與 UNETLoader 節點協同產生新圖像內容,自然融合原有內容。CFGGuider 與 KSamplerSelect 節點根據提示詞與條件細緻調控生成。外延完成後,VAEDecode 節點將潛在表示轉回可見圖像,供儲存或後續編輯。
問答
外延是一種延伸圖像邊界、產生與原圖無縫融合新內容的技術。
可以,但效果會依圖像複雜度與提示詞而異。
流程使用 ComfyUI-Color-Matcher 節點,確保擴展區域色彩與原圖一致。
明確描述所需變更或擴展內容的提示詞(如「延伸地平線」、「去除綠色部分」)效果最佳。
相關工作流程
- Flux.2 Klein
1.3 入門 – 產品攝影
- Flux.2 Dev, Flux.2 Klein, GPT-Image-1.5, Grok, Nano Banana Pro, Qwen-Image-Edit, Seedream
1個輸入與多個編輯模型對比
- Flux, Flux.2 Klein
FLUX.2 [Klein] 4B 蒸餾版:圖片編輯
- Flux, Flux.2 Klein
FLUX.2 [Klein] 4B: 文生圖
- Flux, Flux.2 Klein
FLUX.2 [Klein] 4B:圖片編輯
- Flux, Flux.2 Klein
FLUX.2 [Klein] 9B 蒸餾:圖像編輯
- Flux, Flux.2 Klein
FLUX.2 [Klein] 9B:圖像編輯
- Flux, Flux.2 Klein
FLUX.2 [Klein] 9B:文生圖