Flux Kontext Dev 이미지 편집
전체 노드 가시성으로 Flux Kontext를 사용하여 이미지를 편집하며, 워크플로우 학습에 완벽합니다.
워크플로 내부
소스 템플릿의 읽기 전용 미리보기입니다. Cloud에서 열어 노드를 살펴보고 변경할 수 있습니다.
Loading the graph
Open full-size workflow preview코드에서 이 모델 호출하기
아래 요청은 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({
"136": {
"class_type": "SaveImage",
"inputs": {
"filename_prefix": "ComfyUI",
"images": [
"192:8",
0
]
},
"_meta": {
"title": "Save Image"
}
},
"190": {
"class_type": "LoadImage",
"inputs": {
"image": "UPLOADED_image_FILENAME"
},
"_meta": {
"title": "Load Image"
}
},
"192:124": {
"class_type": "VAEEncode",
"inputs": {
"pixels": [
"192:42",
0
],
"vae": [
"192:39",
0
]
},
"_meta": {
"title": "VAE Encode"
}
},
"192:135": {
"class_type": "ConditioningZeroOut",
"inputs": {
"conditioning": [
"192:6",
0
]
},
"_meta": {
"title": "Conditioning Zero Out"
}
},
"192:146": {
"class_type": "ImageStitch",
"inputs": {
"direction": "right",
"image1": [
"190",
0
],
"match_image_size": True,
"spacing_color": "white",
"spacing_width": 0
},
"_meta": {
"title": "Stitch Images"
}
},
"192:177": {
"class_type": "ReferenceLatent",
"inputs": {
"conditioning": [
"192:6",
0
],
"latent": [
"192:124",
0
]
},
"_meta": {
"title": "Set Reference Latent"
}
},
"192:31": {
"class_type": "KSampler",
"inputs": {
"cfg": 1,
"denoise": 1,
"latent_image": [
"192:124",
0
],
"model": [
"192:37",
0
],
"negative": [
"192:135",
0
],
"positive": [
"192:35",
0
],
"sampler_name": "euler",
"scheduler": "simple",
"seed": 784381637916598,
"steps": 20
},
"_meta": {
"title": "KSampler"
}
},
"192:35": {
"class_type": "FluxGuidance",
"inputs": {
"conditioning": [
"192:177",
0
],
"guidance": 2.5
},
"_meta": {
"title": "FluxGuidance"
}
},
"192:37": {
"class_type": "UNETLoader",
"inputs": {
"unet_name": "flux1-dev-kontext_fp8_scaled.safetensors",
"weight_dtype": "default"
},
"_meta": {
"title": "Load Diffusion Model"
}
},
"192:38": {
"class_type": "DualCLIPLoader",
"inputs": {
"clip_name1": "clip_l.safetensors",
"clip_name2": "t5xxl_fp8_e4m3fn_scaled.safetensors",
"device": "default",
"type": "flux"
},
"_meta": {
"title": "Load CLIP (Dual)"
}
},
"192:39": {
"class_type": "VAELoader",
"inputs": {
"vae_name": "ae.safetensors"
},
"_meta": {
"title": "Load VAE"
}
},
"192:42": {
"class_type": "FluxKontextImageScale",
"inputs": {
"image": [
"192:146",
0
]
},
"_meta": {
"title": "FluxKontextImageScale"
}
},
"192:6": {
"class_type": "CLIPTextEncode",
"inputs": {
"clip": [
"192:38",
0
],
"text": "Change the season and the time of day while keeping the woodcarver, his pose, the workbench and the whole layout of the workshop exactly as they are. It is now a snowy winter evening: deep blue dusk outside the tall windows, snow piled on the window ledges and falling softly beyond the glass. Inside, warm amber light from a few hanging pendant lamps and a glowing cast-iron stove in the corner replaces the cold daylight, casting soft orange highlights on the wood shavings, the timber racks and the carver's hands and face. Keep the same camera angle, the same documentary photographic style, the same textures of wood, denim and steel, and do not add any people, lettering or signs."
},
"_meta": {
"title": "CLIP Text Encode (Positive Prompt)"
}
},
"192:8": {
"class_type": "VAEDecode",
"inputs": {
"samples": [
"192:31",
0
],
"vae": [
"192:39",
0
]
},
"_meta": {
"title": "VAE Decode"
}
}
})
workflow.set_input("190", "image", client.assets.from_url("https://comfy.org/catalog-media/86baffb0-590c-4284-a5e1-70bfcee63197/48e4a7e1-d791-4d4a-a8f4-3c4bf47a393f"))
# 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("136"):
output.to_file(output.name)예시 사용해 보기
이 워크플로 정보
‘Flux Kontext Dev Image Edit’ 워크플로는 캐릭터 일관성을 유지하면서 이미지의 특정 부분만 편집하고 다른 부분은 바꾸지 않아야 하는 고급 이미지 편집 작업을 위해 설계되었습니다. 이 워크플로는 Flux.1 Kontext 모델을 활용하며, 이 모델은 원본 이미지의 스타일을 이해하고 보존하면서 정밀한 수정 작업을 수행하는 데 적합합니다. SaveImage, MarkdownNote, LoadImage 같은 노드와 고유 ID로 식별되는 커스텀 노드를 사용해, 타깃 이미지 수정에 필요한 탄탄한 프레임워크를 제공합니다. 기술적으로는 이미지를 로드한 뒤 확산 모델 ‘flux1-dev-kontext_fp8_scaled.safetensors’을 사용해 지정된 편집을 적용하고, 편집된 이미지를 저장해 원본 스타일과 캐릭터 디테일의 무결성을 유지합니다. 따라서 게임 캐릭터 디자인이나 애니메이션 시리즈처럼 시각적 일관성이 중요한 작업에 특히 유용합니다.
질문과 답변
네, 프롬프트에 여러 편집 지시를 함께 적으면 워크플로가 일관성과 스타일을 유지하면서 적용합니다.
이 워크플로는 인물/캐릭터 일관성과 스타일 유지가 중요한 이미지(예: 인물 사진 또는 스타일화된 아트)에서 가장 효과적입니다.
Flux.1 Kontext 모델은 원본 스타일을 이해하고 재현하도록 설계되어, 편집이 전체적인 미감에 영향을 주지 않도록 합니다.
원본 이미지를 다시 로드하고 프롬프트를 조정해 원하는 결과가 나올 때까지 편집을 반복할 수 있습니다.