Nodes/LLS-node/LLS Simple Mask Draw
ComfyUI Node

LLS Simple Mask Draw

Interactive inpainting masks in LLS

By Gin3601·Created 3 months ago·Updated 3 months ago· 0
LLS Simple Mask Draw
  • image
  • input_mask
  • image
  • mask
  • preview_image
draw_modebrush
brush_size32
brush_softness0.50
overlay_alpha0.40
invert_maskfalse
mask_state_json{}

The worst part of masked inpainting in ComfyUI has always been getting the mask made. Core ComfyUI hands you a Load Mask node and expects you to produce a PNG somewhere. LLS Simple Mask Draw kills that whole detour: you connect your image, paint the region you want regenerated directly on the node, and a mask pops out the other side ready for the repair chain.

It's the hand-painted half of the LLS-node "Simple repair" line - the sibling of LLS Simple Mask Create (which stamps down a geometric rectangle or circle if you want a regular starting shape) and the front door to LLS Simple Repair Prepare.

How it works

There are two halves to this node, and that's the part that confuses people. The painting itself is a JavaScript frontend extension (web/js/lls_mask_draw.js) that draws a canvas overlay on the node and stores your strokes as a base64-encoded PNG inside a hidden widget called mask_state_json. When you queue, the Python side decodes that PNG, resizes it to your image, and hands it back as a real MASK. No painting ever happens in the backend - so if the node's custom widget isn't loaded (API-only use, or you disabled the pack's web files), you get an empty black mask and nothing you do anywhere else matters.

That also means it keeps working across queue runs in a way a one-shot editor wouldn't: the state travels with the node, so you can touch up, run, undo a bit, and run again without redoing the whole mask. Undo and redo are backed by a history stack capped at 20 steps.

The inputs that matter

You only really set a handful of these:

  • image (required) - what you're drawing on. It also passes straight through to the image output.
  • input_mask (optional) - an existing mask to build on. The node resizes it to your image and you keep painting (or erasing) on top of it. This is how you chain LLS Simple Mask Create → this node: geometry first, manual edge-fixing second.
  • draw_mode - brush or erase, toggle in the widget.
  • brush_size (default 32) and brush_softness (default 0.5) - how fat and how feathered your stroke is. Small, soft brushes are your friend for fixing faces; you don't want a hard circle around a repaired eye.
  • overlay_alpha (default 0.4) - opacity of the red overlay so you can actually see the image under it.
  • invert_mask - flips the result, for those moments you realize you masked everything but the thing.

The three outputs are image (passthrough), mask (white = regenerate, black = leave alone), and preview_image - the original with a translucent red mask overlay, which you'll want wired to a Preview node the first few times to sanity-check your painting.

Wiring it in

The minimal manual workflow from the README is exactly the reason this node exists:

Load Image → LLS Simple Mask Draw → LLS Simple Repair Prepare → LLS Simple KSampler → VAE Decode → LLS Simple Repair Finish → Preview Image

Installing

Via ComfyUI Manager, search "LLS-node". Or the old-fashioned way:

cd ComfyUI/custom_nodes
git clone https://github.com/Gin3601/LLS-node

Then restart ComfyUI. There's no requirements.txt in the pack - it leans on core ComfyUI's numpy/PIL/torch, so nothing extra to pip install. Because the drawing UI is a frontend extension, you do need the web/ folder to ship with the install (it does, out of the box) and a browser refresh after updating.

Gotchas

  • V1 only has brush and erase. No rectangle, polygon, magic wand, or auto-segmentation - the README says so in as many words. Need a regular geometric start? LLS Simple Mask Create first, then refine here.
  • The painted mask is stored inside the node's mask_state_json widget, so it does serialize into the workflow when you save or drag a PNG back in - but it only gets there if the pack's web extension loaded and ran. If the frontend ever fails (broken install, stale browser cache, API-only use), you silently get an empty black mask. When that happens, hard-refresh the browser and confirm the drawing overlay appears on the node.
  • mask_state_json looks like an input you should type into. Don't. It's advanced plumbing for the widget; leave it alone.

For a pack this new, expecting the occasional rough edge is fair - but this node is the one part of LLS that genuinely saves time the day you install it.

CategoryLLS/Image Repair

Inputs (8)

NameTypeDefaultDescription
imageIMAGE
draw_modeCOMBObrush2 options: brush, erase
brush_sizeINT321–512
brush_softnessFLOAT0.500–1
overlay_alphaFLOAT0.400–1
invert_maskBOOLEANfalse
mask_state_jsonSTRING{}
input_maskoptMASK

Outputs (3)

NameTypeDescription
imageIMAGE
maskMASK
preview_imageIMAGE