ComfyUI Node

Embed Alpha

Stamping an alpha channel into any image

By amtarr·Created 9 months ago·Updated 4 months ago· 58
Embed Alpha
  • base_image
  • alpha_image
  • image_with_alpha

ComfyUI's IMAGE type mostly lives in RGB-land, but the moment you want to save something with transparency - a decal, a cutout texture for foliage, a sprite - you need a fourth channel, and most nodes won't hand you one. This node is the explicit bridge: it takes a base image and a separate "alpha image," and returns the base with that alpha stamped in as the A channel. No masking logic, no cleverness - it just puts one image's values into the other image's alpha slot, which is exactly what you want 90% of the time.

The mechanics are careful in ways that save you from foot-guns. The alpha input can be a 1-channel grayscale, a 3-channel RGB (it's converted with luminance weights, so a white-on-black mask image works fine), or a 4-channel RGBA - in which case it uses the existing alpha rather than the color, which is a thoughtful touch. It resizes the alpha to match the base if resolutions differ. And it normalizes the base to a clean 3-channel RGB first: strips any existing alpha, or upconverts a 1-channel base to RGB. Then it concatenates: [R, G, B, A] out. That output, image_with_alpha, is a real 4-channel IMAGE you can save as PNG and the transparency will survive.

Inputs are just base_image and alpha_image. That's the whole node. The output naming makes the intent obvious: you're not "masking," you're embedding alpha - the distinction matters because you might want the color channels of the base fully intact while the alpha does all the selection work.

Where it slots into the pack: this is the alpha companion to the channel-packing nodes. The pack's RMAA packer can already write alpha into a material texture, but this one is for when you want a straight RGBA image out of two independent inputs - say, an albedo plus a cutout mask, or a background-removal result (a mask from something like RMBG or a segmenter) stamped onto its own color image so the file carries its transparency. Feed it into a PBR pipeline and you've got a material with a proper opacity map baked in.

Install is the shared pack story: ComfyUI Manager → search "Texture Alchemy", or clone:

cd ComfyUI/custom_nodes
git clone https://github.com/amtarr/ComfyUI-TextureAlchemy

Restart, then Texture Alchemist/Utilities → Embed Alpha. No requirements, no models. Shared gotchas: the README's manual-copy step references the pack's pre-rebrand folder name, and if Manager blocks a Git-URL install, that's ComfyUI's security level - clone by hand rather than weakening it.

CategoryTexture Alchemist/Utilities

Inputs (2)

NameTypeDefaultDescription
base_imageIMAGE
alpha_imageIMAGE

Outputs (1)

NameTypeDescription
image_with_alphaIMAGE