FLUX 3 Image Klein: Image Edit
Edit an existing image with FLUX 3 Image Klein: one input image plus prompts, one refined output and a before/after comparison view.
ワークフローの内部
ソーステンプレートの読み取り専用プレビューです。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({
"2": {
"class_type": "CLIPLoader",
"inputs": {
"clip_name": "qwen3vl_4b_int8_convrot.safetensors",
"device": "default",
"type": "flux3"
},
"_meta": {
"title": "Load CLIP"
}
},
"3": {
"class_type": "VAELoader",
"inputs": {
"vae_name": "flux2-vae.safetensors"
},
"_meta": {
"title": "Load VAE"
}
},
"4": {
"class_type": "CLIPTextEncode",
"inputs": {
"clip": [
"2",
0
],
"text": [
"52",
0
]
},
"_meta": {
"title": "Positive Prompt"
}
},
"7": {
"class_type": "KSampler",
"inputs": {
"cfg": 1,
"denoise": 1,
"latent_image": [
"17",
2
],
"model": [
"59",
0
],
"negative": [
"17",
1
],
"positive": [
"17",
0
],
"sampler_name": "euler",
"scheduler": "simple",
"seed": 341993890347040,
"steps": 50
},
"_meta": {
"title": "KSampler"
}
},
"8": {
"class_type": "VAEDecode",
"inputs": {
"samples": [
"7",
0
],
"vae": [
"3",
0
]
},
"_meta": {
"title": "VAE Decode"
}
},
"9": {
"class_type": "SaveImage",
"inputs": {
"filename_prefix": "image_flux3_klein_distilled_image_edit",
"images": [
"8",
0
]
},
"_meta": {
"title": "Save Image"
}
},
"17": {
"class_type": "ReferenceMultiLatent",
"inputs": {
"images.image0": [
"54",
0
],
"negative": [
"58",
0
],
"positive": [
"4",
0
],
"resolution": "resize",
"resolution.megapixels": 1,
"vae": [
"3",
0
]
},
"_meta": {
"title": "Set Reference Multi Latent"
}
},
"18": {
"class_type": "ImageCompare",
"inputs": {
"compare_view": None,
"image_a": [
"54",
0
],
"image_b": [
"9",
0
]
},
"_meta": {
"title": "Compare Images"
}
},
"34": {
"class_type": "PreviewAny",
"inputs": {
"source": [
"49",
0
]
},
"_meta": {
"title": "Preview as Text"
}
},
"44": {
"class_type": "EmptyFlux2LatentImage",
"inputs": {
"batch_size": 1,
"height": 1024,
"width": 1024
},
"_meta": {
"title": "Empty Flux 2 Latent"
}
},
"46": {
"class_type": "CLIPLoader",
"inputs": {
"clip_name": "qwen3.5_9b_flux3_prompt_upsampler_w4a8.safetensors",
"device": "default",
"type": "flux3"
},
"_meta": {
"title": "Load CLIP"
}
},
"47": {
"class_type": "TextGenerate",
"inputs": {
"clip": [
"46",
0
],
"image": [
"50",
0
],
"max_length": 3584,
"mtp": "off",
"prompt": [
"34",
0
],
"sampling_mode": "on",
"sampling_mode.min_p": 0,
"sampling_mode.presence_penalty": 0,
"sampling_mode.repetition_penalty": 1,
"sampling_mode.seed": 0,
"sampling_mode.temperature": 1,
"sampling_mode.top_k": 1,
"sampling_mode.top_p": 0.95,
"system_prompt": [
"48",
0
],
"thinking": False,
"use_default_template": True
},
"_meta": {
"title": "Generate Text"
}
},
"48": {
"class_type": "PrimitiveStringMultiline",
"inputs": {
"value": "You are the prompt upsampler of an image-editing model. You see the reference image(s), attached in order (the first image, the second image, ...), and the user's short request. Expand it into ONE detailed, self-contained instruction: the caption the editing model receives together with the same images. Output only the instruction as one continuous English prose block, with no greetings, explanations, Markdown, JSON, coordinates, ids or angle-bracket tokens. Read a vague or conversational request as the most plausible edit of the supplied images.\\n\\nPick the voice by task shape. When one reference stays and gets bounded changes, write an imperative editing instruction on it (\\\"Remove the ...\\\", \\\"Change the ... to ...\\\", \\\"Zoom in on ...\\\"); a whole-image transformation opens with its scope (\\\"Convert the entire image into ...\\\", \\\"Apply a ... filter over the entire scene\\\", \\\"Horizontally flip the entire image so that ...\\\", \\\"Shift the camera viewpoint to ...\\\", then where the major elements should now be). When the references are drawn into a newly composed frame (combining subjects, a new scene, a garment, object or style donor), write a generation request (\\\"Create a photograph of ...\\\", \\\"Create an anime-style illustration of ...\\\", \\\"Generate a new image featuring ...\\\") that says what to take from each image, by ordinal, and what is newly generated.\\n\\nKeep every explicit edit, constraint, count, position, style cue and piece of wording, and decide what is left open as one concrete plan. Ground everything in what is actually visible: identify each referent unambiguously by its real appearance, never mention content that is not there, and use every image the user attached. State every end state concretely (which color, how large, which pose, which material) and give new content enough appearance to be generated. Cover the knock-on effects of the change (shadows, reflections, occlusion, perspective, scale, lighting) and say what fills a removed region. A zoom-in names what stays in frame and which neighbors are cropped out; an outpainting continues the scene in the same medium. Describe the change, not the whole scene, and close an editing instruction with one compact clause naming what stays unchanged; transferred people keep their identity, face and accessories unless asked otherwise. Transcribe on-image text verbatim in its original language inside double quotes, with line breaks as \\\\n, and match the original font, size and color when replacing it. Name recognizable public figures, brands and landmarks you can see. Directions are frame-relative; use no evaluative or quality words. Typical length is 50 to 150 words.\\n\\nOutput only the instruction."
},
"_meta": {
"title": "Text (System prompt)"
}
},
"49": {
"class_type": "Flux3LayoutPrompt",
"inputs": {
"element": [
"55",
2
],
"prompt": "In <ref_image_0>, recolour the enormous ruffled ball gown from deep navy satin to a lacquered oxblood red with a faint wet sheen, keeping every fold, ruffle, seam and the beaded bodice exactly as they are. Leave the platinum bob, the mirrored visor, the bare arms and the model's face untouched, and keep her stance on the wet concrete steps unchanged. Preserve the vertical light strips, the falling rain, the dark walls and the reflections on the steps, and keep the cool rim light along her shoulders so the new red reads saturated in shadow and glossy where the strips catch it. Photorealistic fabric detail, no added accessories, no text."
},
"_meta": {
"title": "FLUX 3 Image Layout Prompt"
}
},
"50": {
"class_type": "BatchImagesNode",
"inputs": {
"images.image0": [
"54",
0
]
},
"_meta": {
"title": "Batch Images"
}
},
"51": {
"class_type": "ComfySwitchNode",
"inputs": {
"on_false": [
"47",
0
],
"on_true": [
"34",
0
],
"switch": False
},
"_meta": {
"title": "If/Else Switch"
}
},
"52": {
"class_type": "PreviewAny",
"inputs": {
"source": [
"51",
0
]
},
"_meta": {
"title": "Preview as Text"
}
},
"54": {
"class_type": "LoadImage",
"inputs": {
"image": "UPLOADED_image1_FILENAME"
},
"_meta": {
"title": "Load Image"
}
},
"55": {
"class_type": "CreateBoundingBoxes",
"inputs": {
"background": [
"54",
0
],
"editor_state": {
"__value__": []
},
"height": 1152,
"last_incoming": {
"__value__": [
{
"height": 896,
"metadata": {
"desc": "dress",
"palette": [],
"text": "",
"type": "obj"
},
"width": 736,
"x": 128,
"y": 192
}
]
},
"width": 896
},
"_meta": {
"title": "Create Bounding Boxes"
}
},
"58": {
"class_type": "CLIPTextEncode",
"inputs": {
"clip": [
"2",
0
],
"text": ""
},
"_meta": {
"title": "Negative Prompt"
}
},
"59": {
"class_type": "UNETLoader",
"inputs": {
"unet_name": "flux3-image-klein-base-int8-convrot.safetensors",
"weight_dtype": "default"
},
"_meta": {
"title": "Load Diffusion Model"
}
}
})
workflow.set_input("54", "image", client.assets.from_url("https://comfy.org/catalog-media/d8bc771f-9088-4ddc-beee-c107d612d004/7acdf567-5d2d-4be8-9fc9-1ab9e01940ca"))
# 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("9"):
output.to_file(output.name)例を試す
このワークフローについて
Reference-based editing on FLUX 3 Image Klein base weights (int8 convrot). LoadImage feeds ReferenceMultiLatent, which derives the latent from the reference image (resize, 1 megapixel) so the edit keeps the input framing, and the prompt addresses inputs as <ref_image_0>, <ref_image_1>, ... (add each reference to both positive and negative). KSampler runs 50 steps at cfg 1, euler / simple. A qwen3.5 9B prompt upsampler expands a short request into the full editing instruction, CreateBoundingBoxes marks the region to change, and ImageCompare shows the input next to the edit.