A brush on the node itself. Connect an image and it shows up behind the canvas at its own resolution; connect nothing and you get a blank canvas of the size you set. Paint, scribble, block in a contrast, erase, and the result comes out five ways at once: the image untouched, the image with the strokes on it, the strokes alone, and a mask of exactly what you touched, plus its inverse for transparent exports. The node exists so a quick scribble for ControlNet doesn't need a trip to an external editor.
flowchart LR
LI(["Load Image / VAE Decode"]):::input -. "image (optional)" .-> PAINT
PAINT["**NKD Paint**"]:::nkd -- image --> SRC(["the image, untouched"]):::output
PAINT -- painted --> BLEND(["painted result"]):::output
PAINT -- strokes --> CN(["ControlNet Scribble"]):::external
PAINT -- mask --> MO(["NKD Mask Ops / inpaint"]):::external
PAINT -- "strokes + inverted mask" --> JA(["Join Image with Alpha"]):::external
classDef nkd fill:#3b3b6b,stroke:#8ab4ff,stroke-width:2px,color:#fff
classDef input fill:#2d2d2d,stroke:#888,color:#eee
classDef external fill:#2d2d2d,stroke:#888,color:#eee
classDef output fill:#1f4a1f,stroke:#7fd97f,color:#fff
image(optional). Sets the canvas size and shows behind the strokes. A Load Image wired straight in appears at once. Anything else, a crop, a resize or a VAE Decode, shows what it really produces after the first run, so the node runs on its own when you press Run, with nothing connected downstream.width,height: canvas size when no image is connected. Hidden while one is. Default 1024 × 1024, 64 to 4096 in steps of 8.bg_color: whatstrokesshows where nothing is painted, and the colour of the blank canvas when there's no image. Default black.controlnet: scribble mode. The brush is always white andstrokesis white on black, whatever colour the layer was painted in. Off by default.
image: the base image exactly as it came in. Wire Paint into a chain and nothing changes until you decide to use the strokes.painted: the strokes blended over the base, at the base's resolution.strokes: the strokes alone, in their own colour, withbg_colorwherever nothing is painted. The colour is not premultiplied, sostrokesplusmaskthrough the core "Join Image with Alpha" node gives a clean RGBA with soft edges intact (useinverted maskthere, see below). Incontrolnetmode it's white on black instead, with soft edges as grey, ready for a Scribble ControlNet.mask: the alpha of the strokes. Partial opacity stays partial.inverted mask: the same, inverted. Join Image with Alpha treats mask as "what to hide", so this is the one to wire there withstrokesto get a transparent PNG of the strokes.
BrushandEraserbuttons, orBandE.- The colour swatch opens a picker. Two quick swatches sit next to it for white
and black, and
Xswaps between them. Alt+ left click picks the colour under the cursor, image and strokes together.Alt+ right drag is the Photoshop gesture: left and right change the size, up and down change the hardness (down hardens). The ring shows both while you drag.[and]step the size down and up.Size,OpacityandHardsliders. Opacity applies to the whole stroke when you release, so a stroke never builds up on itself. Hardness goes from a soft airbrush, whose fringe fades out over half the brush, to a solid edge.Basedims the image behind the canvas, so a dark scribble reads over a dark photo. It's only for looking; the outputs ignore it.Shiftwhile dragging any slider moves it at a tenth of the speed.- A pen's pressure scales the brush size.
Ctrl+Zundoes,Ctrl+Shift+ZorCtrl+Yredoes.Clearwipes the layer.- Mouse wheel zooms at the cursor,
Space+ drag or the middle button pans,0fits the canvas again.
Each time you finish a stroke the layer is saved as a PNG under
ComfyUI/input/nkd_paint/, and only that filename is stored in the workflow. The
name is a hash of the picture, so an unchanged layer is a cache hit and the graph
doesn't re-run the node. It also means the drawing travels with the ComfyUI
install, like a Load Image file, not inside the workflow JSON. Old layers you no
longer reference stay in that folder until you delete them.