Nodes/ComfyUI-DD-Nodes/DD Image Stroke
ComfyUI Node

DD Image Stroke

Outlines around subjects, cutout stickers, and the art of the clean edge

By Dontdrunk·Created 2 years ago·Updated 24 days ago· 182
DD Image Stroke
  • 图片
  • 描边颜色
  • 遮罩
  • 描边图片
关闭遮罩false
位置外描边
大小5
不透明度100

If you've ever generated a character cutout and wanted a crisp white outline around it - the kind of thing that makes a sticker or a game sprite pop - you've wanted DD Image Stroke. It adds an outline to a subject using either the image's existing transparency (alpha channel) or a mask you provide, in three styles: outside, inside, or centered on the edge. Part of the DD-Nodes pack, and one of the more genuinely useful image nodes it ships.

How it works

The node works in two regimes depending on what you feed it:

  • With transparency - an RGBA image or an RGB image plus a 遮罩 (Mask) input. The alpha becomes the subject outline. The stroke is computed with OpenCV morphology: outside = dilate the alpha and subtract the original, inside = subtract the eroded alpha from the original, centered = dilate minus erode. That's the "correct" way to do it, and it hugs the subject's actual shape.
  • Without transparency - a plain RGB photo with no mask. There's no subject to trace, so it falls back to drawing a rectangle border around the whole image: a frame at 外描边 (which expands the canvas), 内描边 (a border inside the edges), or 居中描边 (half in, half out).

The controls: 大小 (Size, 1–200 px), 不透明度 (Opacity, 1–100), 描边颜色 (Stroke Color, a hex picker), 位置 (Position - outside/inside/centered), and 关闭遮罩 (Disable Mask), a boolean that when true ignores the mask input entirely. One quirk from the source: when you do connect a mask, the node expects it inverted relative to your instinct - it flips it to use the background as the traceable region. If your outline appears on the wrong side of the subject, that inversion is almost certainly why.

When you'd reach for it

Sticker-style output, sprite sheets, iconography, and any "subject on a solid background" look. It pairs beautifully with a background-removal node: remove the background, stroke the resulting cutout, and composite it onto a card or backdrop. Because the output keeps the alpha, it layers cleanly into any compositing workflow.

Installation

It's part of the one-pack install:

cd ComfyUI/custom_nodes
git clone https://github.com/Dontdrunk/ComfyUI-DD-Nodes
cd ComfyUI-DD-Nodes && pip install -r requirements.txt

Restart ComfyUI or install via ComfyUI Manager (search "ComfyUI-DD-Nodes"). It needs PIL and OpenCV, both in the pack's requirements.

Where people get burned

The mask inversion trips up nearly everyone on the first try. The 外描边 mode on a non-transparent image does nothing visible for the outlined edge (it just expands the canvas and draws a rectangle) - that's by design, since there's no subject silhouette to dilate. And like every node in this pack, the labels default to Chinese; switch ComfyUI's language if you want English. It's a niche tool, but for cutout outlines it's the difference between a two-minute job and a fiddly multi-node detour.

Category🍺DD系列节点

Inputs (7)

NameTypeDefaultDescription
图片IMAGE
关闭遮罩BOOLEANfalse
位置COMBO外描边3 options: 外描边, 内描边, 居中描边
大小INT51–200
不透明度INT1001–100
描边颜色COLOR#000000
遮罩optMASK

Outputs (1)

NameTypeDescription
描边图片IMAGE