Nodes/comfyui-panels/Draw Panels Edges
ComfyUI Node

Draw Panels Edges

The node that draws the black lines around your panels

By bmad4ever·Created 12 months ago·Updated 2 months ago· 41
Draw Panels Edges
  • panels
  • canvas
  • stroke_color
  • IMAGE
  • MASK
stroke_width8.0
color_alpha255
upscale4

Comics have gutters and borders; AI-generated comic panels do not, unless you draw them. Draw Panels Edges is the node that puts the black lines back on the page. Give it your list of panel polygons and a canvas, and it renders the panels' outlines as an image you can composite over your generated panels - or use as a mask to separate the borders.

This is the payoff node for a lot of the pack: generate your panel art, convert the panel shapes to masks, crop and generate per panel, then run this to stamp clean borders back over the assembled page. It's also how you get that crisp visual separation that makes a collage of generated images actually read as a comic instead of floating rectangles. The pack's own "Panel Edges Draw Variants" workflow shows all three edge styles side by side.

How it works

The drawing happens in PIL, but with a trick for quality: it renders at upscale× the canvas size (default 4×), then downscales - effectively supersampling, which is why the tooltip says "draw upscaled by this factor to anti-alias the jaggies away." Without that, diagonal panel borders would come out visibly steppy. The output image is RGBA on a transparent canvas, and the alpha channel is also returned separately as a MASK, so you can use the border drawing as a mask or as an image, whichever your compositing setup needs.

The inputs that matter

  • panels - the list of panel polygons (from Build Layout Panels or Detect Panels In Image).
  • canvas - the page rectangle, which sets image size.
  • stroke_width - default 8, the line thickness in pixels.
  • stroke_color - default #000000, a hex color.
  • color_alpha - default 255, the opacity of the strokes.
  • upscale - default 4, the supersampling factor; leave it unless lines are too soft/hard.

Outputs: an IMAGE (RGBA, transparent outside the strokes) and a MASK.

Installing it

Part of comfyui-panels - Manager, search "comfyui-panels", or:

cd ComfyUI/custom_nodes
git clone https://github.com/bmad4ever/comfyui_panels

Restart, install deps (shapely, matplotlib, opencv-python), no models.

Where people get burned

The COLOR input is a custom widget type that this pack borrows from other packs - the source literally notes it "requires bmad or mtb nodes." If you install comfyui-panels alone and the color field won't render or the node errors, install bmad nodes or MTB and the widget will appear. Also remember the canvas size defines the output resolution: if your edges look tiny or cropped, your canvas doesn't match the image you're compositing onto. And if your panels bleed off the page edge, the border will happily draw over the page boundary - that's expected, not a bug.

CategoryBmad/Panels

Inputs (6)

NameTypeDefaultDescription
panelsPOLYGON
canvasPOLYGON
stroke_widthFLOAT8.01–256
color_alphaINT2551–255
stroke_colorCOLOR#000000
upscaleINT41–8The lines are drawn upscaled by this factor to anti-alias the jaggies away.

Outputs (2)

NameTypeDescription
IMAGEIMAGE
MASKMASK