Nodes/AQnodes for ComfyUI/AQ_BlendImages
ComfyUI Node

AQ_BlendImages

Photoshop blend modes, without leaving ComfyUI

By 2frames·Created about a year ago·Updated 6 months ago· 1
AQ_BlendImages
  • img1
  • img2
  • IMAGE
devicedont_change
blend_mode
opacity1.00

This is the most polished utility in the AQnodes pack, and it's the one I'd actually reach for out of the image tools here. Two images in, one image out, with 27 blend modes, opacity control, and proper alpha handling. If you've ever missed Photoshop's "Hue" or "Color" modes in a compositing workflow, this node covers you.

It's a general compositing tool: overlaying texture or grain, adding a glow or a vignette, blending cover art over a background in the pack's music-video pipeline, or just mixing two renders with an artistic mode. The blend-mode math is implemented directly in torch, so it runs on GPU and operates on whole batches.

How it works

Each blend mode is the classic formula. Screen is 1-(1-a)(1-b), multiply is a*b, overlay and the light modes branch on a threshold, difference is the absolute difference, and so on. The interesting part is the HSB family - Hue, Saturation, Color, Luminosity. Those genuinely need work: the code implements proper luminance, saturation, set_lum/set_sat helpers, and a clip_color function so the color modes behave like Photoshop's instead of a cheap approximation that blows out highlights. The alpha channel is split off from both images, kept intact, and the whole thing is lerped by opacity.

The device input forces CPU or CUDA (default dont_change leaves the tensors where they already are).

Inputs

  • img1, img2 - the two images.
  • device - dont_change, cpu, or cuda.
  • blend_mode - 27 modes: Normal, Dissolve, Darken, Multiply, Color Burn, Linear Burn, Darker Color, Lighten, Screen, Color Dodge, Linear Dodge, Lighter Color, Overlay, Soft Light, Hard Light, Vivid Light, Linear Light, Pin Light, Hard Mix, Difference, Exclusion, Subtract, Divide, Hue, Saturation, Color, Luminosity.
  • opacity - 0 to 1, default 1.

Output

IMAGE - the blended result, same dimensions as the inputs.

Install

Part of AQnodes:

cd ComfyUI/custom_nodes
git clone https://github.com/2frames/ComfyUI-AQnodes
cd ComfyUI-AQnodes
pip install -r requirements.txt

or search "AQnodes" in ComfyUI Manager and restart.

Gotchas

It raises a hard ValueError if the two images don't have identical dimensions - there's no auto-resize, so match sizes with a resize/crop node first. And "Photoshop-style" is the right way to read it: the math is the standard blend formulas, but it's not bit-identical to Photoshop, and the extreme modes (Hard Mix, Vivid Light) can look a little different on edge cases. For normal compositing that's irrelevant.

CategoryAQ

Inputs (5)

NameTypeDefaultDescription
img1IMAGE
img2IMAGE
deviceCOMBOdont_change3 options: dont_change, cpu, cuda
blend_modeCOMBO27 options: Normal, Dissolve, Darken, Multiply, Color Burn, Linear Burn, +21
opacityFLOAT1.000–1

Outputs (1)

NameTypeDescription
IMAGEIMAGE