Nodes/ComfyUI 1hewNodes/Image Blend Mode by Alpha
ComfyUI Node

Image Blend Mode by Alpha

Photoshop-style blend modes, driven by alpha

By 1hew·Created about a year ago·Updated 7 days ago· 33
Image Blend Mode by Alpha
  • overlay_image
  • base_image
  • overlay_mask
  • image
blend_modenormal
overlay_fitstretch
opacity1.00
invert_maskfalse

Compositing is where "AI image" becomes "image": you generate an overlay, then blend it onto a base so it reads like it was shot together. Image Blend Mode by Alpha is the workhorse for that step - it takes an overlay, a base, and a blend mode straight out of Photoshop, and composites them with the overlay's alpha (or a mask you supply) controlling where the blend applies.

It's from ComfyUI 1hewNodes, solo dev 1hew's utility pack (bilingual README, active v3.x, low community profile). This is one of the pack's better nodes - a genuine Photoshop-layer replacement inside the graph.

How it works

The blend math is per-pixel and mirrors Photoshop: multiply, screen, overlay, soft_light, hard_light, color_dodge, difference, exclusion, hue/saturation/color/luminosity - 26 modes plus normal and a fun-but-useless dissolve. Each mode is a small formula (screen is 1-(1-base)*(1-overlay), overlay splits at 0.5 brightness, and so on), all computed in torch.

The part that makes it compositing rather than just filters is the alpha channel. The overlay's own alpha is multiplied by opacity, optionally multiplied by a supplied overlay_mask, and that becomes the effective blend mask: where alpha is 1 the blend mode applies, where it's 0 the base shows through untouched. That's how you blend a texture or a light source into just part of a scene without hard seams.

overlay_fit handles sizing: stretch resizes the overlay to the base's dimensions, center places it centered and blends only in the covered region (padded by alpha outside). If the base had alpha, the output stays RGBA; otherwise you get RGB. The output is properly un-premultiplied, so no dark fringing around semi-transparent edges.

The inputs that matter

  • base_image and overlay_image - the two layers. Base wins where the overlay has no alpha.
  • blend_mode - the Photoshop-style mode (default normal).
  • opacity - 0 to 1 global strength (default 1).
  • overlay_mask - optional MASK that further gates where blending happens; invert_mask flips it.
  • overlay_fit - stretch or center.

Output is a single image. Typical chain: generate a texture/lighting pass → this node onto your main render → preview. For CSS-standard modes there's a sibling node in the pack (Image Blend Mode by CSS, built on pilgram); this alpha-driven one is usually the one you want for compositing.

Installing it

ComfyUI Manager → search "1hew" / "ComfyUI 1hewNodes" → install → restart. Manual:

cd ComfyUI/custom_nodes
git clone https://github.com/1hew/ComfyUI-1hewNodes

The pack's requirements are heavy (opencv, scikit-image, scikit-learn, plus ultralytics/rembg/transformers for other nodes), so first install takes a few minutes. No models for this node. Requires a current ComfyUI (the pack uses the modern node API).

Gotchas

  • Blend mode not applying - check opacity and the mask. If overlay_mask is all black (or inverted), the blend is invisible everywhere. That's not a bug, it's compositing working as ordered.
  • Unexpected RGBA out - if your base had an alpha channel, output keeps 4 channels. Some downstream nodes choke on that; split or drop alpha if needed.
  • dissolve is a party trick - it randomly keeps or drops overlay pixels per frame, so it flickers frame-to-frame in video. Fine for stills, avoid for sequences.
Category1hewNodes/image/blend

Inputs (7)

NameTypeDefaultDescription
overlay_imageIMAGE
base_imageIMAGE
blend_modeCOMBOnormal26 options: normal, dissolve, darken, multiply, color_burn, linear_burn, +20
overlay_fitCOMBOstretch2 options: stretch, center
opacityFLOAT1.000–1
invert_maskBOOLEANfalse
overlay_maskoptMASK

Outputs (1)

NameTypeDescription
imageIMAGE