Nodes/ComfyUI_MieNodes/Kontext Prompt Generator ๐Ÿ‘
ComfyUI Node

Kontext Prompt Generator ๐Ÿ‘

LLM-written edit prompts for Flux Kontext

By MieMieeeeeยทCreated about a year agoยทUpdated 21 days agoยท 225
Kontext Prompt Generator ๐Ÿ‘
  • llm_service_connector
  • kontext_prompt
โ—„image1_descriptionโ–บ
โ—„image2_descriptionโ–บ
โ—„edit_instructionโ–บ
โ—„presetKomposer: Teleport - ๅœบๆ™ฏไผ ้€โ–บ
โ—„seed0โ–บ

Flux Kontext edits images from a sentence - "change the jacket to red," "remove the background text" - but the quality of the edit lives or dies on how well that sentence is written. This node uses an LLM to write it for you. You describe your image(s), say what you want changed, pick a preset transformation, and it produces a clean, Kontext-shaped instruction you can drop straight into your editing workflow.

It's part of ComfyUI-MieNodes (ComfyUI_MieNodes), MieMieeeee's utility pack, in the Prompt Generator group.

Why you'd bother

Flux Kontext is Black Forest Labs' instruction-based image editor: feed it an image and a prompt, get the same image back with the clothing swapped, the background changed, or a watermark gone. The KB's Kontext panel describes it as making instruction editing a local commodity, "shockingly effective" at things like watermark removal.

The catch is that a vague instruction gives a vague edit. Kontext responds to phrasing that pins down what stays and what changes, and writing that consistently by hand gets old fast. This node offloads the wording to an LLM that's been briefed (via a built-in system prompt) on how Kontext likes to be talked to. You supply the intent; it supplies the phrasing. That's the same LLM-writes-the-instruction pattern the KB's prompt-engineering doc calls the modern default.

The preset is the interesting part. It's a menu of common transformations - Teleport the subject to a new scene, Move Camera, Relight, Product shot, Zoom, Colorize, Movie Poster, Cartoonify, Remove Text, Haircut, and more (20 in all). Pick one and the node builds the prompt around that kind of edit, so you're not starting from a blank line every time.

The inputs and outputs that matter

All required:

  • llm_service_connector - from any of the pack's Set...Connector nodes. This node needs a live LLM to do the writing.
  • image1_description and image2_description - multiline text describing your input image(s). Kontext workflows often involve a source and a reference, hence two. Fill in one or both. A common pattern is to generate these automatically with a captioner (the pack's own example uses Florence2) and feed the caption in here.
  • edit_instruction - what you actually want done, in plain words.
  • preset - the transformation type (default "Komposer: Teleport"). This steers the whole rewrite.
  • seed - vary it to get a different phrasing of the same request.

Output is kontext_prompt (STRING) - wire it into the text/conditioning input of your Flux Kontext workflow.

Installing it

ComfyUI Manager โ†’ search ComfyUI-MieNodes โ†’ install โ†’ restart. Or:

cd ComfyUI/custom_nodes
git clone https://github.com/MieMieeeee/ComfyUI-MieNodes

then restart. The node itself downloads nothing, but note it does two things that need setup: it calls an LLM (so configure a connector and key), and it only produces a prompt - you still need an actual Flux Kontext model loaded elsewhere in your graph to run the edit. Nodes appear under the ๐Ÿ‘ MieNodes menu.

Common issues

Edits ignore something you wanted kept. That's a Kontext behavior, not a bug in this node - describe the thing you want preserved in the image descriptions, so the generated instruction can protect it. The clearer your image1_description, the better the LLM can phrase "keep everything else the same."

Full-body and small-subject edits degrade. The KB's Kontext panel notes heads and hair artifact once a full body fits the frame, and proportions skew. No prompt fixes that - it's a model limitation. Refine with a normal img2img pass afterward.

NSFW is off the table. Kontext's license added an anti-circumvention clause and platforms enforce it; NSFW LoRAs get removed. If that's your use case, the KB points you at Qwen-Image-Edit instead. This node can't route around the model's censorship.

A generic-sounding output. Give the LLM more to work with. A one-word edit_instruction and empty image descriptions produce a bland prompt; specifics in, specifics out.

Category๐Ÿ‘ MieNodes/๐Ÿ‘ Prompt Generator

Inputs (6)

NameTypeDefaultDescription
llm_service_connectorLLMServiceConnectorโ€”
image1_descriptionSTRINGDescribe the first image
image2_descriptionSTRINGDescribe the second image
edit_instructionSTRINGโ€”
presetCOMBOKomposer: Teleport - ๅœบๆ™ฏไผ ้€20 options: Komposer: Teleport - ๅœบๆ™ฏไผ ้€, Move Camera - ็งปๅŠจ้•œๅคด, Relight - ้‡ๆ–ฐ็…งๆ˜Ž, Product - ไบงๅ“ๆ‘„ๅฝฑ, Zoom - ๆ”พๅคงไธปไฝ“, Colorize - ๅ›พๅƒ็€่‰ฒ, +14
seedINT00โ€“18446744073709550000The random seed used for creating the noise.

Outputs (1)

NameTypeDescription
kontext_promptSTRINGโ€”