Nodes/ComfyUI-NynxzNodes/Sticker Outline
ComfyUI Node

Sticker Outline

From AI cutout to a die-cut line you can actually print

By Nynxz·Created 11 months ago·Updated about 12 hours ago· 4
Sticker Outline
  • image
  • mask
  • image
  • mask
◄threshold0.50►
◄smoothness2.0►
◄min_speck_size64►
◄fill_holesfalse►
◄close_gaps0►
◄fill_color#ffffff►
◄keep_largestfalse►
◄upscale1►
◄border_width0►
◄border_color#ffffff►
◄edgeblend►
◄antialiasfalse►

Every "make a sticker from this image" workflow hits the same wall, and it isn't the cutout. BiRefNet or InSPyReNet will find your subject fine. What they hand back is a segmentation: a soft, wobbly, slightly ragged alpha edge with a grey fringe around it. Screen-print that, or send it to a vinyl cutter, and you get a dark halo plus a stair-stepped outline that looks like it was cut with pinking shears.

Sticker Outline is the deterministic cleanup pass that turns that into a cut line. No model, no sampler - pure pixel math, and that's the point. The pixels it hands back are the pixels you keep.

What it's doing, step by step

Alpha comes in (the image's own, or a wired MASK, which wins), and gets thresholded: at or above threshold is kept, everything else goes. smoothness is an edge-smoothing radius in source pixels - it rounds jaggies and small notches off the contour. min_speck_size deletes islands and fills pinholes smaller than that many pixels, which is how stray blobs from the segmenter disappear. keep_largest goes further and keeps only the biggest connected piece, and it runs first, so strays are gone before smoothing and closing can get confused by them.

close_gaps bridges gaps and bays open to the outside - the space between an arm and the body, a gap between two legs - so the cut line is one simple loop instead of a maze. fill_holes handles enclosed holes. Then upscale (1 to 8) does the trick that makes this node worth using for print: at 1× the alpha is binary at pixel scale, which is inherently stair-stepped. Work at 2–4× and the boundary is a smooth curve at final size. If your stickers look ragged when printed at 300dpi, this is the number, not smoothness.

The bit that solves the grey halo: edge. On blend (the default) the semi-transparent fringe ring is recoloured from the nearest solid pixel inside it, so the anti-aliased grey that a segmenter left around a white shirt stops printing as dirty grey. fill paints that ring with fill_color instead, for art that has its own drawn outline. keep leaves it as drawn. There's a band limit here worth knowing - only the outer ~3 source pixels count as fringe; deeper semi-transparency is treated as real texture and left alone, which is correct for a veil or smoke and occasionally annoying on a bad cutout.

border_width then adds a solid die-cut border in source pixels, with border_color as hex, and the canvas grows by that much on every side so the border is never clipped. antialias softens the finished edge to about a pixel for screen use - Discord, Telegram, a web gallery. Leave it off for print and cutting, which want a hard edge; the shape is identical either way.

Outputs are image (RGBA, alpha strictly 0 or 1 unless antialias is on) and mask (the final shape, in ComfyUI's convention where white = transparent, so it wires straight into Join Image with Alpha or any other mask node).

The settings order that works

Start from the default and fix one thing at a time: raise min_speck_size until strays are gone, then smoothness until the edge is clean but thin details (a finger, an antenna, a hair spike) survive - the tooltip's own rule is that details thinner than about twice the radius are lost. Add close_gaps if the outline has bays you don't want to cut around. Only then set upscale and border_width.

Installing it

Manager → search Nynxz → ComfyUI-NynxzNodes, or:

comfy node install comfyui-nynxz-nodes

From source:

cd ComfyUI/custom_nodes
git clone https://github.com/Nynxz/ComfyUI-NynxzNodes
cd ComfyUI-NynxzNodes
pnpm install && pnpm build

Restart after. No models to download - the whole point is that this node is math. It does import scipy.ndimage, and so do a couple of the region nodes in the same pack; ComfyUI normally brings scipy with it, but on a stripped-down container image a pip install scipy in the ComfyUI python env is the fix if the pack fails to import.

Troubleshooting

fill_color and border_color must be hex (#ffffff, #fff, hash optional). Junk in those fields raises a ValueError with the value quoted, so if your run dies with "must be a hex colour like #ffffff, got …", it's a typo, not a crash.

If the sticker comes out with a hard square edge somewhere, your source image is clipped at the frame boundary - this node never invents pixels outside the image, so a subject cut off by the canvas stays cut off.

And if close_gaps and fill_holes produced an ugly blob, check whether you have edge = blend and a fill_color you expected to be used: fill_color only affects close_gaps/fill_holes area and the fill edge mode. On blend the added area comes from the surrounding colours, which is usually what you want on art with no drawn border.

If the whole fringe looks like it was cut with a slightly wrong outline, that's the segmenter, not this node. Bit of a broken record in this ecosystem, but it applies: don't ask a segmentation model to do a matting job and then expect post-processing to recover the difference.

CategoryNynxz/Image

Inputs (14)

NameTypeDefaultDescription
imageIMAGEThe sticker. RGBA images use their own alpha; for RGB, wire `mask`.
thresholdFLOAT0.500.01–0.99Alpha at or above this is kept. Lower grows the shape into soft edges; higher trims them.
smoothnessFLOAT2.00–64Edge smoothing radius in source pixels. Higher rounds more; details thinner than about twice this are lost. 0 = threshold only.
min_speck_sizeINT640–1000000Islands and pinholes smaller than this many source pixels are removed. 0 keeps everything.
fill_holesBOOLEANfalseFill every enclosed hole, leaving one solid outer shape.
close_gapsFLOAT00–256Bridge gaps and bays narrower than about twice this (source pixels), e.g. between an arm and the body, for a simpler cut line. 0 = off. Unlike fill_holes, works on gaps open to the outside.
fill_colorSTRING#ffffffColour for area close_gaps and fill_holes add, and for the edge when edge is 'fill'. Match your sticker's border. 'blend' uses the surrounding colours instead.
keep_largestBOOLEANfalseKeep only the biggest piece, dropping stray elements outside the sticker. Runs first, so strays are gone before smoothing and closing.
upscaleINT11–8Work and output at this multiple of the source size. A binary edge is stair-stepped at pixel scale; 2-4 gives smooth curves for print.
border_widthFLOAT00–512Solid border around the shape, in source pixels. The canvas grows by this on every side so the border is never clipped. 0 = none.
border_colorSTRING#ffffffBorder colour as hex, e.g. #ffffff.
edgeCOMBOblendThe semi-transparent outline ring. 'blend' recolours it from the solid pixels inside, removing grey or dark fringes. 'fill' paints it with fill_color, for art with its own drawn border and outline. 'keep' leaves it as drawn.
antialiasBOOLEANfalseSoften the edge to about 1px, for stickers shown on screen (Discord, Telegram, web). Leave off for print and cutting, which want a hard edge. The shape is the same either way.
maskoptMASKTransparency as Load Image outputs it (white = transparent). Overrides the image's own alpha.

Outputs (2)

NameTypeDescription
imageIMAGERGBA. Alpha is strictly 0 or 1 unless antialias is on.
maskMASKThe final shape, core convention (white = transparent), for Join Image with Alpha or other mask nodes.