LayerMask: MaskStroke
Make an outline mask from any mask edge
- mask
- mask
Take a mask, get back just its outline - a stroke that runs along the mask's edge at whatever width you set. It's the Photoshop "Stroke" layer effect, but producing a mask. Feed that stroke mask into a color fill and you've got a clean border around your subject: sticker-style outlines, highlight rings, sign edges, that white-outline-around-the-cutout look that's everywhere in thumbnails and product shots.
The reason it's a mask output and not a finished outline is flexibility - you decide what color the stroke is by compositing the mask over your color of choice, or you use the stroke region to drive an inpaint, a glow, whatever. This node just gives you the shape of the border.
How it works
It finds the mask's boundary and builds a band around it. stroke_width is how thick that band is; stroke_grow lets you push the stroke outward or inward from the exact edge (positive grows it out, negative pulls it in) so you can sit the outline just outside the subject or overlapping it; and blur softens the stroke so it's not a hard line.
The inputs and outputs that matter
mask(MASK) - the shape whose edge you want to trace.invert_mask(BOOLEAN, default true) - defaults to true. If the stroke traces the wrong boundary, this is the usual cause.stroke_width(INT, 0–999, default 20) - thickness of the outline. The main dial.stroke_grow(INT, −999 to 999, default 0) - offset the stroke out (+) or in (−) from the edge. Handy for placing the outline just clear of the subject.blur(INT, 0–100, default 6) - softness of the stroke edges; 0 for a crisp line, higher for a glowy band.
Output is a single mask (MASK) containing the stroke.
How to install it
ComfyUI Manager: search ComfyUI Layer Style, install, restart. Or:
cd ComfyUI/custom_nodes
git clone https://github.com/chflame163/ComfyUI_LayerStyle
Restart to install requirements. No models.
Common issues & troubleshooting
A missing node points to the pack-wide IMPORT FAILED issue - ComfyUI_LayerStyle not loading. Check the console at startup. Across this pack it's usually a stale install from before the split into ComfyUI_LayerStyle and ComfyUI_LayerStyle_Advanced (delete the folder, reinstall clean), or a broken dependency crashing the import. Reinstall via Manager.
Node-wise: the invert_mask default of true is the top gotcha - if the outline hugs the background instead of the subject, flip it. If your stroke looks like a filled blob rather than an outline, stroke_width is huge relative to the shape, or blur is drowning it - dial both down. To get a colored outline in the final image, composite this mask over a solid color (a ColorOverlay-style node) or feed it a fill; the stroke mask itself is grayscale.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| mask | MASK | — | |
| invert_mask | BOOLEAN | true | — |
| stroke_grow | INT | 0-999–999 | — |
| stroke_width | INT | 200–999 | — |
| blur | INT | 60–100 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| mask | MASK | — |