Nodes/comfyui-momo-nodes/RGB Mask Editor ✏️
ComfyUI Node

RGB Mask Editor ✏️

Draw your own masks with a mouse — the RGB Mask Editor turns a blank canvas into a region map

By Phykrex·Created 4 months ago·Updated 4 months ago· 0
RGB Mask Editor ✏️
    • image
    • mask
    width1024
    height1024
    bg_color#FF0000
    shapes_json[]

    Most masking in ComfyUI starts with an image you already have - a photo to inpaint, a render to refine. But the regional-prompting workflow needs a mask that doesn't exist yet: a color-coded map that says "this slice of the canvas is region A, this is region B." Normally you'd paint that in an external editor, save it, load it back in. RGB Mask Editor skips all that. It opens a small canvas right inside ComfyUI where you drag out shapes, color them, and hand you back an RGB image that defines your regions. It's the first half of the Momo Nodes regional pipeline - Editor → RGB Mask Splitter → Conditioning Mask Combine → KSampler.

    What it actually does

    The node generates a fresh image from nothing. It takes no input image - you give it a width, a height, a bg_color, and a shapes_json string, and it renders a flat-color composition. There's an "🎨 Open RGB Mask Editor" button on the node (added by the pack's JavaScript) that pops up a real editing canvas: drag to create shapes, drag handles to move/resize/rotate, stack them in layers. Everything is stored as percentages in shapes_json, so the same mask definition re-renders cleanly at any resolution - that's the resolution-independent part, and it's genuinely handy if you change your base size later.

    Nine shape types ship in: rectangle, ellipse, triangle, diamond, pentagon, hexagon, star, arrow, and cross. That's more than enough for region authoring. The editor has undo/redo (Ctrl+Z / Ctrl+Y), a few keyboard shortcuts (V = select, R = rect, E = ellipse, Del = delete), and Shift + rotate snaps to 15°. It's a small tool, but it's a usable small tool - a proper canvas, not a coordinate text box.

    The inputs and outputs that matter

    • width / height - canvas size, 64 to 8192 in steps of 8. Match these to your generation size; the mask gets fed to the sampler at this resolution.
    • bg_color - a hex string, default #FF0000 (red). That default isn't random: the intended flow is a colored background plus differently-colored shapes, because the splitter downstream separates by color.
    • shapes_json - the JSON blob the editor writes. You'll almost never hand-edit this, but it means the whole mask is portable: copy the string and your mask moves with it.

    Outputs are image (the composed RGB picture) and mask (a grayscale version of the same picture). Here's the trap that catches people: that mask output is one luminance mask - the whole image darkened to gray - not per-region separation. It's fine for masking, but it is not what you want for regional prompting. Feed the image output into RGB Mask Splitter instead, and let it pull the individual color regions apart.

    Installing it

    The whole pack is one install, no model downloads, no extra dependencies beyond Pillow/torch/numpy, which ComfyUI already ships. From ComfyUI Manager, search Momo Nodes. Or manually:

    cd ComfyUI/custom_nodes/
    git clone https://github.com/Phykrex/ComfyUI-Momo-Nodes.git
    

    Then restart ComfyUI (and hard-refresh the browser tab - the editor button lives in JS). Nodes show up under MomoNodes/mask.

    Things to know before you rely on it

    This is a very new pack - one commit, essentially no community track record as of writing, so treat it as a fresh tool and verify output visually. Two real quirks: shapes composite with per-shape opacity, so overlapping colored shapes blend - keep regions non-overlapping or the splitter's color matching gets confused. And because coordinates live in shapes_json as percentages, editing the JSON by hand is possible but easy to break; use the canvas. Start with the pack's own example flow (editor → splitter → combine) and it works out of the box, since the editor's red background matches the splitter's default red target.

    CategoryMomoNodes/mask

    Inputs (4)

    NameTypeDefaultDescription
    widthINT102464–8192
    heightINT102464–8192
    bg_colorSTRING#FF0000
    shapes_jsonSTRING[]

    Outputs (2)

    NameTypeDescription
    imageIMAGE
    maskMASK