Composite Images π§
Composite two images like a mini Photoshop, without leaving the graph
- image_B
- image_F
- mask_opt
- IMAGE
If you only install one node from ComfyUI-NegiTools, this is probably it - because it's the one that doesn't need an OpenAI key or a model download, and it solves a problem you'll actually hit: putting two images together with control over how they blend. It's a real compositing tool hiding in a pack that mostly orbits OpenAI stuff.
What it does
The node takes a background image (image_B), a foreground image (image_F), and layers the foreground on top using a per-pixel alpha. At alpha = 0.0 you get the background untouched; at alpha = 1.0 you get the full composite; anything in between is a weighted mix. In the simplest case - foreground with an alpha channel composited over a background - that's a one-wire job.
Where it gets interesting is method, which switches on 16 blend modes. default just drops the foreground over the background, but you also get the whole classic set: multiply, screen, overlay, dodge, burn, hard_light, soft_light, difference, add, subtract, lighten, darken, plus thru_B/thru_F which are just passthroughs of one input or the other. Those aren't gimmicks. multiply and screen are how you composite lighting or baked-in shadows; add is how you layer a glow without washing out the base. It's numpy doing the math under the hood, so it's fast and deterministic.
The optional mask_opt input is the one that earns this node its keep. If you connect a MASK, it gets multiplied into the alpha, so you get per-pixel control over where the foreground shows through. Wire in a face mask or a soft gradient and the foreground fades in exactly where you want it.
The inputs that matter
image_B/image_F- the background and foreground. Order matters, obviously.method- the blend mode.defaultfor straightforward layering,multiply/screenfor lighting tricks.alpha- the global opacity slider, 0.0 to 1.0.mask_opt- optional per-pixel alpha. This is the one worth connecting.
Output is a single IMAGE, ready to feed a VAE decode, a save node, or the next compositing step.
One gotcha
There's no resizing anywhere in this node. image_B and image_F need to be the same dimensions, and mask_opt needs to match too - if the shapes disagree, you'll get a numpy broadcast error rather than a helpful message. If your images aren't the same size, run them through an image resize node first.
Installing it
It ships in the ComfyUI-NegiTools pack. Easiest path is ComfyUI Manager - search for "ComfyUI-NegiTools" and install. By hand:
cd ComfyUI/custom_nodes
git clone https://github.com/natto-maki/ComfyUI-NegiTools
pip install -r ComfyUI-NegiTools/requirements.txt
then restart ComfyUI. The requirements are heavier than this one node needs (numba, opencv, scikit-image, the OpenAI client) because the pack has OpenAI and pose-detection nodes too, but you only pay for them once. None of the utility nodes here - this one, Seed Generator, Image Properties - need the OPENAI_API_KEY that the GPT/DALL-E nodes require, so you can use them with zero setup beyond the install.
Where it sits in a workflow
Think of it as the glue step: composite an inpainted region back over the original, paste a generated element into a scene, or stack a lighting pass onto a base render. If you're doing classic masked inpainting, this is often the cleaner way to put the fixed region back - you get a hard edge or a feathered one depending on the mask you feed it, instead of hoping the sampler blends it for you.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| image_B | IMAGE | β | |
| image_F | IMAGE | β | |
| method | COMBO | 16 options: default, thru_B, thru_F, multiply, divide, screen, +10 | |
| alpha | FLOAT | 1.000β1 | β |
| mask_optopt | MASK | β |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | β |