ComfyUI Node Runs on cloud

Layer Stroke

An outline that follows the subject, not its box

By WASasquatch·Created 3 years ago·Updated 4 days ago· 1,844
Layer Stroke
  • layers
  • layers
layer_index-1
layer_name
alignmentouter
width4
color#000000
opacity1.00
blend_modenormal

Layer Stroke draws an outline along the edge of one layer in a stack - and the edge it follows is the layer's actual coverage, not its rectangle. That distinction is the whole node. A cut-out subject gets an outline around the subject's silhouette; a text layer gets an outline around the letterforms, not a box around the words. If you've ever reached for a "border" filter on a transparent PNG and watched it draw a rectangle, you know exactly why this one exists.

The controls

  • alignment - where the band sits against the edge. outer sits wholly outside and grows the layer; inner sits wholly inside and grows nothing; centre straddles the edge and grows the layer by half the width. Outer is the classic sticker look, inner is the inset ring you see on UI buttons and badge text.
  • width - the band's span in pixels. 2 is a hairline, 8 a clear outline, 24 a heavy border, 0 draws nothing. Because outer bands grow the layer, an outer stroke of 12 makes the layer 24 wider and 24 taller in each dimension's terms - the tooltip is explicit about that, and it's the mechanism behind the "my canvas grew" effect this pack talks about with its other effects.
  • color - hex, three-digit shorthand welcome. Black or white are the default instincts; orange #ff8800 is the look for a "make this pop off the plate" badge.
  • opacity and blend_mode - how the band lands. normal lays it down as-is; multiply darkens, screen lightens, difference inverts where band meets layer.

Target a layer with layer_index (0 = bottom, -1 = top) or layer_name. Output is the stack with the stroke baked into that layer's picture and transparency.

Where it fits

Stroke is a sibling of the glow, shadow and overlay effects - same shape of node, same "pick one layer, bake one effect, pass the stack on" contract. Chain them: a stroked and shadowed title layer reads on any background. An outer stroke is also the cheap way to fake a keyline or a sticker die-cut edge when you want to see the silhouette before committing to a mask operation, because the stroke traces coverage precisely.

One behaviour worth knowing before it bites: an inner stroke follows the same coverage, so on a layer with a soft, feathered edge the band's inside half eats into the faint pixels and can make the edge look harder. Stroke after you've finalised the mask, not before.

Installing it

Part of WAS Node Suite:

cd ComfyUI/custom_nodes
git clone https://github.com/WASasquatch/was-node-suite-comfyui.git

or ComfyUI Manager → "WAS Node Suite v3", then restart. Requires ComfyUI 0.14.0+ and Python 3.10+; v3 installs no pip packages.

Where people trip

Expecting a rectangular border and getting a silhouette, or the reverse - remembering that this node is coverage-based settles most confusion. And the growth thing: an outer stroke genuinely enlarges the layer's drawn size, so if you're stroking a layer that sits against a canvas edge, the picture can exceed the canvas unless the stack has a canvas pinned (Layers Canvas) to clip it. Stroke early in the chain when you can, so downstream nodes see the final size.

CategoryWAS Suite/Image/Layers

Inputs (8)

NameTypeDefaultDescription
layersLAYERSThe stack holding the layer to outline. Wire in Add Layer, Layers From Bounding Boxes, or another layer effect to stack effects up.
layer_indexINT-1-1000–1000Which layer to outline when layer_name is empty. -1 = the top of the stack, -2 = the one below it, 0 = the bottom, 1 = the next one up.
layer_nameSTRINGName of the layer to outline, matched ignoring case and spare space. Empty reads layer_index instead. 'subject' picks the layer Add Layer was given that name.
alignmentCOMBOouterWhere the band sits against the edge. `outer` sits wholly outside and grows the layer, `inner` sits wholly inside and grows nothing, `centre` straddles the edge and grows the layer by half the width.
widthINT40–128Pixels the band spans. 2 = a hairline, 8 = a clear outline, 24 = a heavy border, 0 = nothing drawn. An outer band of 12 makes the layer 24 wider and 24 taller.
colorSTRING#000000Colour of the band, as hexadecimal digits. #000000 = black, #ffffff = white, #ff8800 = orange. Three digits such as #f80 work too.
opacityFLOAT1.000–1How strongly the band is laid down. 1.0 = solid, 0.5 = half strength, 0.0 = nothing.
blend_modeCOMBOnormalHow the band mixes with the layer's own pixels where the two overlap. `normal` lays the colour down as it is, `multiply` darkens, `screen` lightens, `difference` inverts.

Outputs (1)

NameTypeDescription
layersLAYERSThe stack with the outline baked into that layer's picture and transparency. Wire it into Create Layered Image or the next effect.