Shadow Or Outline From Alpha
Your cutout is clean. Now give it a shadow — or a sticker outline — from the alpha alone
- image
- effect_image
- effect_mask
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) oroutline. 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_yis 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/bgroups 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.
Inputs (17)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| mode | COMBO | shadow | 2 options: shadow, outline |
| threshold | INT | 100–255 | — |
| outline_thickness | INT | 81–128 | — |
| outline_feather | INT | 20–64 | — |
| outline_r | INT | 00–255 | — |
| outline_g | INT | 00–255 | — |
| outline_b | INT | 00–255 | — |
| outline_opacity | FLOAT | 1.000–1 | — |
| shadow_blur | INT | 180–128 | — |
| shadow_expand | INT | 40–64 | — |
| shadow_offset_x | INT | 0-512–512 | — |
| shadow_offset_y | INT | 16-512–512 | — |
| shadow_opacity | FLOAT | 0.280–1 | — |
| shadow_r | INT | 00–255 | — |
| shadow_g | INT | 00–255 | — |
| shadow_b | INT | 00–255 | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| effect_image | IMAGE | — |
| effect_mask | MASK | — |