Nodes/comfyui-shadow-outline/Shadow Or Outline From Alpha
ComfyUI Node

Shadow Or Outline From Alpha

Your cutout is clean. Now give it a shadow — or a sticker outline — from the alpha alone

By Victor8730·Created 5 months ago·Updated 5 months ago· 0
Shadow Or Outline From Alpha
  • image
  • effect_image
  • effect_mask
modeshadow
threshold10
outline_thickness8
outline_feather2
outline_r0
outline_g0
outline_b0
outline_opacity1.00
shadow_blur18
shadow_expand4
shadow_offset_x0
shadow_offset_y16
shadow_opacity0.28
shadow_r0
shadow_g0
shadow_b0

The hard part is already done. You've run the cutout - rembg, BiRefNet, whatever - and you've got a clean RGBA image of your subject floating on nothing. Now you drop it onto a nice background and it sits there flat, like a sticker that forgot it had depth. This node is the finishing step that pipeline is missing: give it the alpha-bearing image, pick shadow or outline, and it hands back an effect layer plus a mask, ready to composite.

It's one node, "Shadow Or Outline From Alpha", in the image/wps category. No model files, no API, no key, no VRAM. Just Pillow math on your alpha channel.

How it works

Mechanically it's dead simple, which is exactly why it's useful. The node pulls the alpha channel out of your RGBA image, clips anything below threshold to zero (that's the "removes weak alpha noise" knob), then does one of two things:

  • Shadow mode - morphologically expands the silhouette (MaxFilter), blurs it, shifts it by an offset, tints it your chosen color, and scales opacity. Result: a soft drop shadow generated from the shape itself, not a rectangle.
  • Outline mode - expands the silhouette, subtracts the original mask, and what's left is the ring. That ring gets feathered and colored. Result: a sticker-style outline around the subject, without the subject.

Both modes return the same two outputs: effect_image (an RGBA IMAGE of the shadow or outline on a transparent background) and effect_mask (the same effect as a grayscale MASK). You wire effect_image into a composite node - the core ImageCompositeMasked works fine - and blend it under or around your subject.

The inputs that matter

There are 15 knobs, but you'll touch maybe four. The defaults are genuinely sane, which is rare:

  • mode - shadow (default) or outline. Your only real decision.
  • threshold - default 10. Nukes faint alpha before the effect is built.
  • shadow_blur (18), shadow_expand (4), shadow_offset_y (16), shadow_opacity (0.28) - the shadow's softness, how far the silhouette bulges before blur, how far down it drops, and how dark. shadow_offset_y is the one you'll fiddle with; 16 down is a nice mid-air contact shadow start.
  • outline_thickness (8), outline_feather (2), outline_opacity (1.0) - thickness in pixels, edge softness, and how solid the ring is.
  • The *_r/g/b groups set effect color. Black is the default for both, which is right for shadows and a reasonable sticker outline.

Install

Zero dependencies - no requirements.txt, no model downloads, nothing to grab from HuggingFace. Easiest route is ComfyUI Manager: search "comfyui-shadow-outline" and install. Or do it by hand:

cd ComfyUI/custom_nodes
git clone https://github.com/Victor8730/comfyui-shadow-outline

Restart ComfyUI and the node shows up as "Shadow Or Outline From Alpha". It's a two-file pack, so it loads instantly.

Where people get burned

  • No alpha channel = no silhouette. The README is explicit: if the input has no alpha, the effect is generated from the full rectangular image area. If your shadow comes out as a blurry rectangle, your "cutout" never actually got cut. Feed it RGBA.
  • It only looks at the first frame of a batch. The code grabs image_tensor[0] and moves on. Batch-queueing 40 product shots through it silently uses the first one every time - iterate per image instead.
  • Threshold eats soft edges. Default 10 is great for killing rembg's faint edge noise, but it's also a hard cut. If your subject has genuinely semi-transparent pixels - hair, glass, a veil - the threshold punches holes in the shape and your shadow inherits them. Drop it toward zero for soft-alpha subjects, raise it for noisy solid ones.

Why you'd reach for it

In the classic product-photography loop - cutout, generate scene, composite, IC-Light to match lighting - the missing piece is usually grounding. IC-Light fixes the color of the light; a drop shadow is what makes the object sit on the background instead of floating over it. That's the shadow mode. And the outline mode is your whole "sticker card" or packaging mockup look without hunting through a stack of mask nodes to build the ring yourself. It's a small node, but it's the difference between a cutout that looks pasted and one that looks placed.

Categoryimage/wps

Inputs (17)

NameTypeDefaultDescription
imageIMAGE
modeCOMBOshadow2 options: shadow, outline
thresholdINT100–255
outline_thicknessINT81–128
outline_featherINT20–64
outline_rINT00–255
outline_gINT00–255
outline_bINT00–255
outline_opacityFLOAT1.000–1
shadow_blurINT180–128
shadow_expandINT40–64
shadow_offset_xINT0-512–512
shadow_offset_yINT16-512–512
shadow_opacityFLOAT0.280–1
shadow_rINT00–255
shadow_gINT00–255
shadow_bINT00–255

Outputs (2)

NameTypeDescription
effect_imageIMAGE
effect_maskMASK