Nodes/InsertAnything-ComfyUI-official/InsertAnything - Redux Process
ComfyUI Node

InsertAnything - Redux Process

How InsertAnything tells Flux what the object looks like

By mo230761·Created about a year ago·Updated about a year ago· 26
InsertAnything - Redux Process
  • ref_image
  • ref_mask
  • IMAGE

The reference half of the trick

InsertAnything doesn't describe the object you're inserting with text - it shows Flux a picture of it. Redux Process is the node that prepares that picture. It takes your reference image and its mask and turns them into a clean, centered, white-background 768×768 image that feeds Flux Redux (through CLIPVisionEncodeStyleModelApply in the workflow). That's the "image prompt" path: Flux's SigLIP encodes the reference, and the generation carries the object's look - texture, color, form - into the fill region without a single word of prompt.

That's also why the workflow zeroes out the text conditioning (ConditioningZeroOut). The reference is the prompt.

What it does, step by step

  • Background removal via mask - every pixel outside ref_mask gets flattened to white. This is deliberate: the model should copy the object, not its backdrop. If your reference has a busy background and the mask is sloppy, the background leaks into the result.
  • Crop to the object - takes the mask's bounding box and crops the image to it, dropping the empty margin.
  • Expand and square - pads ~1.3× around the object and then pads to a square, so the object sits centered with a little breathing room regardless of the source aspect ratio.
  • Resize to 768×768 - the fixed size Redux conditioning expects.

Inputs and output

Two inputs, one output - the simplest node after MaskOption:

  • ref_image - your reference photo.
  • ref_mask - an outline of the object in it. This mask matters more than the image, honestly; it's what defines "the object."

The single IMAGE output goes to CLIPVisionEncode, which hands the embedding to StyleModelApply along with the Flux Redux style model. It also gets reused inside FillProcess (same reference-processing logic) to build the diptych - so the same ref_image/ref_mask pair drives both the image prompt and the visual context.

Why it's still 768×768 in the no-scaling workflow

Worth knowing if you use the no-scaling pipeline: Redux Process always outputs 768×768, even there. That's not a bug - this node isn't the diffusion canvas, it's conditioning. The generation happens at your crop's native resolution; the reference just needs to be a consistent, square image for the SigLIP encoder. A stable reference shape means a stable style embedding, which means the object look survives across different target resolutions.

Install

ComfyUI Manager: search InsertAnything or install via Git URL https://github.com/mo230761/InsertAnything-ComfyUI-official.git. Manual:

cd ComfyUI/custom_nodes
git clone https://github.com/mo230761/InsertAnything-ComfyUI-official.git

Restart, then load the shipped InsertAnything.json or InsertAnything_noscaling.json from ComfyUI/user/default/workflows. Pack-wide caveat: no requirements.txt, but cv2 and diffusers are imported at load time - pip install opencv-python diffusers into the ComfyUI env if the pack won't import. The workflow needs flux1-redux-dev + sigclip_vision_patch14_384, flux1-fill-dev (fp8), SD3 text encoders, flux-ae, and the insert-anything-lora.safetensors (WensongSong/Insert-Anything on HuggingFace). ~26 GB VRAM typical.

Gotchas

  • A bad reference mask is the #1 way this pack disappoints. Redux Process binarizes masks at 128 and assumes white = background. Feather too much and you carry a white halo into the style embedding; cover too little and you crop off the object. The original project's tip applies here: the mask must fully cover the thing you want inserted.
  • If the inserted object doesn't look like your reference at all, suspect this node first - check preview_image from FillProcess to see what actually made it into the graph.
Categorysd

Inputs (2)

NameTypeDefaultDescription
ref_imageIMAGE
ref_maskMASK

Outputs (1)

NameTypeDescription
IMAGEIMAGE