Nodes/ComfyUI/Painter
ComfyUI Node Runs on cloud

Painter

Paint your inpainting mask right in the graph

By Comfy-Org·Created 4 years ago·Updated 20 days ago· 121,575
Painter
  • bg_color
  • image
  • IMAGE
  • MASK
mask
width512
height512

The most complained-about part of ComfyUI inpainting isn't the model - it's the masking. People come from Forge or Krita where you paint a mask on a canvas, and ComfyUI hands them a file loader. Painter is core's answer: an actual paint widget on the node, so you draw your mask directly in the browser instead of preparing a mask file somewhere else. For anyone who wants the old-school mask-based inpainting workflow without leaving the graph, this is the node.

What it is

Inputs: a mask field - which is not a text box but a PAINTER widget, an actual paint surface with a brush - plus width/height (64–4096, in 64-step increments, hidden from the default view), a bg_color hex picker (default #000000), and an optional image input described in the schema as the "Optional base image to paint over." Outputs:

  • IMAGE - the painted result: your strokes composited over the base (or over the solid bg_color if no base image was given).
  • MASK - the painted strokes as a mask tensor.

The mechanism, from the source: if a base image is connected, the canvas takes its size and the painting is composited over it using the paint's alpha; without a base, it builds a solid bg_color canvas at width×height. The mask output is the paint's alpha directly - painted strokes are 1.0, unpainted areas are 0.0 - which is exactly the ComfyUI inpainting convention (white = regenerate). The IMAGE output also gets a live preview, so you see your strokes as you draw.

The workflow it plugs into

This is the "paint the mask yourself" route to masked inpainting, the one the KB's inpainting guide describes as the classic pattern (and the one that's increasingly optional as instruction-editing models arrive - but for bit-identical unmasked pixels and true masked fixes, it's still the way). The shape is:

Load Image → Painter (paint over it) → MASK → SetLatentNoiseMask / InpaintModelConditioning → KSampler

You paint the region you want regenerated, the MASK tells the sampler where to work, and ImageCompositeMasked (or the crop-and-stitch pair) pastes the result back so your unpainted pixels stay byte-identical. The IMAGE output is equally useful: it's your inpaint base with the strokes visible, which you can feed straight into the conditioning as the reference image.

The gotchas

  • Mask convention is "paint = regenerate." Your strokes become the white region of the mask. People who paint the region they want kept (the Photoshop instinct) get it backwards and regenerate the wrong half. Paint what you want replaced.
  • The canvas is limited. No layers, no brush-size finesse of a real editor, and width/height snap to 64-pixel steps. For surgical masks you'll still want to prepare a file and load it via Load Image (as Mask). Painter is for quick, broad masks - and that's fine, because that's most inpainting.
  • It's a newer experimental node. The widget-based input is part of ComfyUI's newer node system; nothing to install, but the exact widget behavior has room to shift.

If the missing piece of your inpainting workflow was "a paintbrush," Painter is the built-in that closes it.

Categoryimage

Inputs (5)

NameTypeDefaultDescription
maskSTRING
widthINT51264–4096
heightINT51264–4096
bg_colorCOLOR#000000
imageoptIMAGEOptional base image to paint over

Outputs (2)

NameTypeDescription
IMAGEIMAGE
MASKMASK