ComfyUI Node

RC Stroke

An outline around anything

By kj863257·Created 11 months ago·Updated 10 months ago· 16
RC Stroke
  • image
  • IMAGE
size3.0
positionoutside
opacity1.00
color_r0
color_g0
color_b0
blend_modenormal
fill_opacity1.00
auto_expand_canvastrue

Text and stickers look unfinished without an outline, and in ComfyUI "draw a border around this" used to mean three or four nodes of mask extraction and dilation held together by hope. RC_Stroke is the pack's Photoshop-style layer effect: a proper stroke with inside/outside/center positioning, a color picker, blend mode, and auto canvas expansion so outside strokes don't get clipped. It's the sibling of Outer Glow and Drop Shadow in the RC Image Compositor pack, under RC/Layer Effects.

How it works

Same layer-style engine as the glow node, pointed the other direction: it reads the image's alpha as a mask, expands it by the stroke width using morphological dilation, and paints the stroke color around the shape's edge. The position control decides where:

  • outside - the stroke rings the shape's outer edge. With auto_expand_canvas on, the canvas grows to fit it.
  • inside - the stroke eats into the shape itself. Shape keeps its original footprint; the border is on the interior.
  • center - straddles the edge, half in, half out.

The controls you'll actually set:

  • size (0–50 px) - stroke width.
  • position - above.
  • color_r / color_g / color_b - stroke color, 0–255.
  • opacity (0–1) - stroke strength.
  • blend_mode - normal, plus multiply, screen, overlay, and color_burn for matching the stroke to the background's lighting.
  • fill_opacity - again the fun one: original image's opacity. 1.0 = normal, 0.0 = hollow outline only (the sticker becomes just its border), 0.5 = ghosted content plus stroke.
  • auto_expand_canvas - grows the output for outside/center strokes.

Output is a single IMAGE, potentially larger than the input when expansion kicks in.

Installing it

ComfyUI Manager → search "RC Image Compositor" → install, restart. Manual:

cd ComfyUI/custom_nodes
git clone https://github.com/kj863257/ComfyUI_RC_Image_Compositor
cd ComfyUI_RC_Image_Compositor
pip install -r requirements.txt

Dependencies: pillow, numpy, opencv-python. Nothing to download.

Where people get burned

  • Canvas expansion changes your dimensions. An outside stroke grows the canvas by 2× size on each relevant axis. If a downstream node expects the original size, that's the cause - disable auto-expand or composite after.
  • center strokes bleed over the alpha edge. Because the border straddles the boundary, the stroke inherits the shape's own semi-transparent edges. A clean alpha makes a clean center stroke; a rough one looks muddy.
  • Outside stroke on a non-transparent image is nearly invisible. Stroke outlines the alpha boundary. A full-frame RGB image has no boundary to outline, so the stroke hugs the image edge and you'll wonder where it went. Cut the shape out first (RC MaskApply / LoadImageWithAlpha) and then stroke it.
  • fill_opacity 0 gives you the outline look you probably want for stickers. If your goal was a bordered decal, 0.0 + a stroke is the whole recipe.

Strokes are one of those effects that seems trivial until you need it twice a week. RC Stroke makes it a single node with the exact knobs Photoshop users expect - and the hollow-outline mode is worth the install by itself.

CategoryRC/Layer Effects

Inputs (10)

NameTypeDefaultDescription
imageIMAGE
sizeFLOAT3.00–50Stroke width in pixels
positionCOMBOoutsideStroke position relative to shape
opacityFLOAT1.000–1Stroke opacity
color_rINT00–255Stroke color red component (0-255)
color_gINT00–255Stroke color green component (0-255)
color_bINT00–255Stroke color blue component (0-255)
blend_modeCOMBOnormalStroke blend mode: - normal: Normal blending, direct overlay - multiply: Multiply, darkens colors - screen: Screen, lightens colors - overlay: Overlay, enhances contrast - color_burn: Color burn, deeper shadows
fill_opacityFLOAT1.000–1Original image fill opacity: - 1.0: Normal image display - 0.0: Hollow effect, stroke only - 0.5: Semi-transparent image + stroke
auto_expand_canvasBOOLEANtrueAuto expand canvas: - True: Auto expand canvas when stroke exceeds bounds - False: Stroke is clipped to original canvas size

Outputs (1)

NameTypeDescription
IMAGEIMAGE