Nodes/ComfyUI-FastMask/FastMask Editor
ComfyUI Node

FastMask Editor

The ComfyUI mask editor that doesn't fight you

By zaum·Created 12 days ago·Updated a day ago· 4
FastMask Editor
  • image_opt
  • image
  • mask
image
mask_path

FastMask Editor is the fix for the moment you dread in every manual inpainting job: right-clicking an image in ComfyUI, opening the built-in mask editor, and fighting a laggy brush on a 4K canvas. It's a from-scratch replacement - an image loader and a full-screen canvas editor in one node, built to stay smooth on big images where the stock editor turns into treacle. No extra dependencies, no server component, just a JS frontend and a thin loader node.

Mask-based inpainting still earns its keep even in the age of instruction-editing models: when you need pixel-identical unmasked regions, exact boundary placement, or the denoise dial rather than a sentence, a hand-painted mask is the only way to get it. Every one of those jobs starts at the same place - you need a good mask. That's the niche this node exists for.

How it works

The heavy lifting happens in the browser, not on your GPU. The editor paints on a preview canvas capped at 2048px (that's why the brush feels instant even on a 12MP photo), and only on OK does it export the mask at the full original resolution. The tricks, straight from the author: dirty-rectangle rendering that redraws only the strokes you touched, a single requestAnimationFrame loop that sleeps when nothing changed, zoom/pan as a pure CSS transform, and tile-based undo/redo that snapshots only the 256×256 tiles you dirtied instead of whole images.

When you hit OK, the mask is saved to ComfyUI/input/fastmask/ at full resolution, and restored the next time you open the editor. A small composite preview (image + mask, max 1024px JPEG) rides along so you can see what you've masked at a glance. All saves go through ComfyUI's standard /upload/image API - no separate backend to install.

One thing not to expect: the README lists in-browser SAM segmentation (MobileSAM/FastSAM via onnxruntime-web) as planned, not implemented. Don't go hunting for a segment button yet.

Inputs and outputs that matter

The node is an output node, so think of it as a LoadImage with a mask editor bolted on:

  • image (required, dropdown) - lists every file in your ComfyUI/input folder, with the usual upload/refresh buttons, exactly like LoadImage.
  • image_opt (optional, IMAGE) - wire another node's image output here and it overrides the dropdown selection. Reach for this when your image is already in the graph from a prior node.
  • mask_path (required, hidden STRING) - you don't type into this; it records which saved mask file to restore.
  • Outputs: image (IMAGE) - the loaded image, passed straight through - and mask (MASK), where 1.0 = masked area and 0.0 = untouched. Beginners routinely flip this; your brush paints 1s.

Wire mask into the mask input of a Set Latent Noise Mask or conditioning node, or an inpaint pipeline, and image where you'd have put the LoadImage output. Blur (0–100%, real-time) lives in the editor, so you can feather the mask before it leaves the node.

Painting, quickly

Hold left mouse to paint, right to erase, X to flip modes. Ctrl+drag or [/] for brush size, mouse wheel to zoom (cursor-anchored), middle-drag or Space to pan, Ctrl+Z / Ctrl+Y for undo/redo, Ctrl+Delete to clear. Closed-shape autofill is on by default (toggle with F) - trace a loop and it fills itself in, which is how you'll actually cut out a subject. Buttons show their shortcuts on hover (⌘ on a Mac). Enter commits, Esc bails.

Install

The pack is named ComfyUI-FastMask. Either search for "fastmask" in ComfyUI Manager → Custom Nodes Manager and install, or:

cd ComfyUI/custom_nodes
git clone https://github.com/zaum/ComfyUI-FastMask

Restart ComfyUI and FastMask Editor appears under the mask category (right-click an image and look for "Edit Mask" too). pyproject.toml declares zero Python dependencies, so nothing extra to pip-install and no model to download. Compatibility: you want a current ComfyUI - the editor leans on recent frontend features.

Gotchas worth knowing

  • Empty mask ≠ error. With no mask saved yet the node returns an all-zero mask ("nothing masked") - intentional, not a bug.
  • Masks live on disk, not in your workflow PNG. Share a workflow with a painted mask and the receiving machine won't have the file under its own input/fastmask/.
  • Odd editor behavior after an update? The pack forces no-cache on its own frontend JS because ComfyUI Desktop caches stale copies; hard-refresh (Ctrl+Shift+R) before blaming the node.
  • Huge exports ask first. A 64-megapixel guard makes you confirm before an export that would eat hundreds of MB of RAM.

The pack is young and barely shows up in searches - no reputation yet, good or bad. But the code is clean, the approach (preview-resolution editing, full-res export) is the right one, and anyone doing manual masks regularly will feel the difference immediately.

Categorymask

Inputs (3)

NameTypeDefaultDescription
imageCOMBO4 options: GiftHelperSuite_Chroma_Source_92532474.mp4, GiftHelperSuite_Example_Background_213ee241.png, GiftHelperSuite_PostFX_Source_bebfe94a.mp4, example.png
mask_pathSTRING
image_optoptIMAGE

Outputs (2)

NameTypeDescription
imageIMAGE
maskMASK