Nodes/ComfyUI/TextEncodeMageFlowEdit
ComfyUI Node Runs on cloud

TextEncodeMageFlowEdit

Type the edit, point at the image, and let the model do the Photoshopping

By Comfy-Org·Created 4 years ago·Updated about 5 hours ago· 128,055
TextEncodeMageFlowEdit
  • clip
  • images
  • vae
  • positive
  • negative
  • latent
prompt
negative_prompt
width0
height0
batch_size1

Mage-Flow-Edit is Microsoft's instruction-based image editor, and with the July 2026 core release ComfyUI speaks it natively. The workflow is the modern version of "make it a dragon": you give it one or more reference images and a plain-English instruction, and this node turns that pair into the conditioning plus the starting latent that a normal sampler denoises. It sits in the same family as TextEncodeQwenImageEdit and the other *Edit encoders - the idea being that the model understands an instruction, not just a caption.

What it does

Think of it as a text-encode node with attachments. It does four things in one pass:

  1. Tokenizes your prompt (the edit instruction) and negative_prompt through the Mage-Flow CLIP, a Qwen3-VL-4B text encoder.
  2. VAE-encodes every reference image into "reference latents" and staples them onto the conditioning. The negative branch carries the same reference images - only the instruction differs - so the model knows what not to change.
  3. Resizes all references to the output resolution first. That's not cosmetic: Mage's RoPE aligns reference and target content by position, so if references and output don't match in size, the alignment is off.
  4. Hands you a ready-made latent to sample - which brings us to the one tip that matters most.

The input that decides your resolution

width and height default to 0, which means "use the first reference image's size", floored to a multiple of 16. Set them explicitly and every reference gets resized to that. Either way, use the node's latent output for sampling - that's the whole reason it exists. Roll your own empty latent at a different size and the conditioning and latent won't line up, and you'll chase subtle misalignment artifacts for an hour.

The rest of the inputs are quick: images is an autogrow slot that takes up to 16 references, batch_size controls how many results you sample at once, and vae is technically optional but you want it - it's what encodes the references into those latent blocks.

Outputs

  • positive and negative CONDITIONING → sampler
  • latent → sampler's latent input

How you get it

Ships with ComfyUI core since July 2026. The node loads nothing itself - feed it the clip and vae from the Mage-Flow checkpoint you load (Microsoft's weights; the edit variant is the one this node is built for).

Gotchas

  • The instruction is the whole game. Prompt it like you're talking to a person: "make it night, keep the composition." Keep the negative prompt short; it's doing the same instruction job with references attached.
  • Safety filters. Some Mage-Flow builds ship with a filter that blanks outputs on recognizable people - it's a known community complaint about the model, not a sign your prompt is broken.
  • Size mismatch = artifacts. Always sample the node's own latent.

This is the node to reach for when you want "change this thing in this picture" without redrawing the whole image or fighting an inpaint mask. Point, type, sample.

Categorymodel/conditioning/mage

Inputs (8)

NameTypeDefaultDescription
clipCLIP
promptSTRING
negative_promptSTRING
imagesCOMFY_AUTOGROW_V3Reference image(s) to edit. All references are resized to the output resolution before encoding.
widthINT00–8192Output width. 0 = use the first reference image's size.
heightINT00–8192Output height. 0 = use the first reference image's size.
batch_sizeINT11–4096
vaeoptVAE

Outputs (3)

NameTypeDescription
positiveCONDITIONING
negativeCONDITIONING
latentLATENT