2.2 Creator - 디퓨전 가이드
Z Image Turbo로 인페인팅과 controlnet을 사용해 디퓨전을 유도하고, 정확한 이미지 편집을 하는 방법을 알아보세요.
정보
ComfyUI의 '2.2 Creator - Diffusion Guidance' 워크플로는 인페인팅 및 ControlNet 기법을 통합해 이미지 편집 정밀도를 높이도록 설계되었습니다. 이 워크플로의 핵심은 확산 프로세스를 효율적이고 정확하게 수행하는 Z Image Turbo 모델입니다. 워크플로는 CLIPLoader와 VAELoader 같은 다양한 노드를 사용해 이미지를 로드하고 처리하며, DifferentialDiffusion과 InpaintModelConditioning 같은 노드로 공간적으로 변화하는 수정이 반영되도록 디퓨전을 가이드합니다. 이를 통해 모델 재학습 없이도 정밀한 이미지 편집이 필요한 작업에 특히 유용합니다.
이 워크플로는 ControlNet를 사용해 캐니 엣지나 깊이 맵 같은 구조적 가이드를 제공하여, 디퓨전 프로세스가 원하는 구조 요소를 따르도록 합니다. 이는 ZImageFunControlnet 및 Controlnet Preprocessor 같은 노드로 구현됩니다. 픽셀 단위의 'strength' 맵을 사용해 부드럽고 점진적인 변화를 만들 수 있어, 주변 맥락의 무결성을 유지하면서 특정 영역만 인페인팅해야 하는 고정밀/고컨트롤 작업에 적합합니다.
제공할 항목
- 워크플로 읽는 중
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({
"92": {
"class_type": "CLIPLoader",
"inputs": {
"clip_name": "qwen_3_4b.safetensors",
"device": "default",
"type": "lumina2"
},
"_meta": {
"title": "Load CLIP"
}
},
"93": {
"class_type": "VAELoader",
"inputs": {
"vae_name": "ae.safetensors"
},
"_meta": {
"title": "Load VAE"
}
},
"94": {
"class_type": "VAEDecode",
"inputs": {
"samples": [
"112",
0
],
"vae": [
"93",
0
]
},
"_meta": {
"title": "VAE Decode"
}
},
"95": {
"class_type": "ConditioningZeroOut",
"inputs": {
"conditioning": [
"99",
0
]
},
"_meta": {
"title": "Conditioning Zero Out"
}
},
"96": {
"class_type": "DifferentialDiffusion",
"inputs": {
"model": [
"98",
0
],
"strength": 1
},
"_meta": {
"title": "Differential Diffusion"
}
},
"98": {
"class_type": "ModelSamplingAuraFlow",
"inputs": {
"model": [
"109",
0
],
"sampling": "flow",
"shift": 3
},
"_meta": {
"title": "ModelSamplingAuraFlow"
}
},
"99": {
"class_type": "CLIPTextEncode",
"inputs": {
"clip": [
"92",
0
],
"text": "sunglasses."
},
"_meta": {
"title": "CLIP Text Encode (Prompt)"
}
},
"100": {
"class_type": "SaveImage",
"inputs": {
"filename_prefix": "Z-Image-Turbo",
"images": [
"94",
0
]
},
"_meta": {
"title": "Save Image"
}
},
"101": {
"class_type": "UNETLoader",
"inputs": {
"unet_name": "z_image_turbo_bf16.safetensors",
"weight_dtype": "default"
},
"_meta": {
"title": "Load Diffusion Model"
}
},
"103": {
"class_type": "ModelPatchLoader",
"inputs": {
"name": "Z-Image-Turbo-Fun-Controlnet-Union-2.1.safetensors"
},
"_meta": {
"title": "Load Model Patch"
}
},
"105": {
"class_type": "InpaintModelConditioning",
"inputs": {
"mask": [
"108:184",
0
],
"negative": [
"95",
0
],
"noise_mask": True,
"pixels": [
"108:181",
0
],
"positive": [
"99",
0
],
"vae": [
"93",
0
]
},
"_meta": {
"title": "InpaintModelConditioning"
}
},
"106": {
"class_type": "MaskPreview",
"inputs": {
"mask": [
"108:184",
0
]
},
"_meta": {
"title": "Preview Mask"
}
},
"107": {
"class_type": "LoadImage",
"inputs": {
"image": "gsc_creator_2_2_input.png"
},
"_meta": {
"title": "Load Image"
}
},
"109": {
"class_type": "ZImageFunControlnet",
"inputs": {
"end_percent": 1,
"image": [
"108:181",
0
],
"inpaint_image": [
"108:181",
0
],
"mask": [
"108:184",
0
],
"model": [
"101",
0
],
"model_patch": [
"103",
0
],
"start_percent": 0,
"strength": 1,
"vae": [
"93",
0
]
},
"_meta": {
"title": "Apply Fun ControlNet"
}
},
"112": {
"class_type": "KSampler",
"inputs": {
"cfg": 1,
"denoise": 1,
"latent_image": [
"105",
2
],
"model": [
"96",
0
],
"negative": [
"105",
1
],
"positive": [
"105",
0
],
"sampler_name": "res_multistep",
"scheduler": "simple",
"seed": 467616719697168,
"steps": 9
},
"_meta": {
"title": "KSampler"
}
},
"122": {
"class_type": "ImageStitch",
"inputs": {
"direction": "down",
"image1": [
"107",
0
],
"image2": [
"94",
0
],
"match_image_size": True,
"spacing_color": "white",
"spacing_width": 0
},
"_meta": {
"title": "Stitch Images"
}
},
"123": {
"class_type": "PreviewImage",
"inputs": {
"images": [
"122",
0
]
},
"_meta": {
"title": "Preview Image"
}
},
"108:181": {
"class_type": "ImageResize+",
"inputs": {
"condition": "always",
"height": 1024,
"image": [
"107",
0
],
"interpolation": "lanczos",
"method": "keep proportion",
"multiple_of": 0,
"width": 1024
},
"_meta": {
"title": "🔧 Image Resize"
}
},
"108:182": {
"class_type": "ImageResize+",
"inputs": {
"condition": "always",
"height": 1024,
"image": [
"108:183",
0
],
"interpolation": "lanczos",
"method": "keep proportion",
"multiple_of": 0,
"width": 1024
},
"_meta": {
"title": "🔧 Image Resize"
}
},
"108:183": {
"class_type": "MaskToImage",
"inputs": {
"mask": [
"107",
1
]
},
"_meta": {
"title": "Convert Mask to Image"
}
},
"108:184": {
"class_type": "ImageToMask",
"inputs": {
"channel": "red",
"image": [
"108:182",
0
]
},
"_meta": {
"title": "Convert Image to Mask"
}
}
})
# run() also passes api_key to the partner nodes in this workflow.
job = client.run(workflow, api_key=api_key)질문과 답변
ControlNet는 엣지 또는 깊이 맵 같은 특징을 사용해 디퓨전 프로세스에 구조적 가이드를 제공하며, 편집 변경이 원하는 구조 요소를 따르도록 보장합니다.
Differential Diffusion은 픽셀 단위 'strength' 맵으로 부드럽고 점진적이며 공간적으로 변화하는 수정 적용을 가능하게 해, 모델 재학습 없이 정밀한 인페인팅을 지원합니다.
이 워크플로는 주로 단일 이미지 편집용으로 설계되었지만, 이미지 로드와 마스크 생성 단계를 자동화하면 배치 처리로 확장할 수 있습니다.
인페인팅의 경우 KSampler denoise 파라미터를 0.5~1.0으로, ModelSampling shift를 3.0~10.0으로 설정하는 것을 권장하며, 원하는 디테일 수준과 부드러움에 따라 조정합니다.