ComfyUI Node

RGBYP Load Image

RGBYP Load Image

By akawana·Created 9 months ago·Updated 8 days ago· 5
RGBYP Load Image
    • image
    • rgbyp_mask
    • mask
    • file_path
    • file_name
    image
    updater0.7500

    RGBYP Load Image is the front door of the RGBYP Mask Editor pack, and the reason the pack exists. It loads an image like the stock Load Image node, but it also hands you a clean, separate rgbyp_mask output - a five-color mask where Red, Green, Blue, Yellow and Pink each mark a different region you painted. If you've ever tried regional prompting in ComfyUI you already know the pain this solves: with a plain Load Image, your brush strokes get baked into the image itself, and when you split by color afterwards you get dirty, contaminated edges. This node keeps the mask as its own thing, so the split comes out clean.

    Why five colors?

    Regional prompting is the standing answer to two characters whose attributes keep bleeding into each other - a prompt describes the whole canvas, so the girl on the left steals the girl on the right's hair. The cheap fix is to paint each character into its own color region and condition each region separately. Five colors is just enough for the classic compositions: two characters, a background, and a couple of props. You paint once, then split.

    How it works

    The editor is a JavaScript overlay you open by right-clicking any image node. When you draw, the pack writes temp files - a meta.json plus a mask PNG - into ComfyUI's temp/ folder, keyed by the node's unique id. On the next run, RGBYP Load Image reads that meta file back, restores the original filename (it strips the _<id>__rgbyp suffix the editor adds), and hands you the image, the mask, and the file helpers. If you haven't drawn anything, you get a 64×64 black placeholder instead of an error - which is a nice touch, because downstream nodes that demand a mask get one.

    The inputs and outputs that matter

    There are only two inputs. image is the file picker - same as stock Load Image. The second, updater, is a float widget the README says plainly: do not touch it, do not connect anything to it. It exists for internal editor logic. Ignore it.

    The outputs are where this node earns its keep:

    • image - the image itself, same as stock.
    • rgbyp_mask - the five-color mask as an IMAGE. This is the one you feed into RGBYP Mask To Regular Masks (to get real MASK tensors), RGBYP Mask To List, or the Composite node.
    • mask - a standard grayscale MASK output, for the boring path where you only need one mask.
    • file_path - full path to the source image excluding the filename.
    • file_name - the filename without extension. These two exist so RGBYP Save Mask can drop your mask back next to the original.

    Installing it

    This is part of the RGBYP Mask Editor pack, so it comes with the other eight nodes. Easiest: ComfyUI Manager → Install Custom Nodes → search RGBYP → install, then restart ComfyUI. Or the manual route:

    cd ComfyUI/custom_nodes
    git clone https://github.com/akawana/ComfyUI-RGBYP-Mask-Editor.git
    

    Then restart ComfyUI. No model downloads, no pip installs - the pack is a thin Python wrapper over the editor JS, and everything it needs (torch, numpy, PIL, scipy) is already in a stock ComfyUI install.

    Where people get burned

    The big one is persistence. All masks live in ComfyUI/temp/, which ComfyUI wipes on restart. Your mask survives a browser refresh but dies with the server. If you want to keep it, save it with RGBYP Save Mask and reload it next session via the Load Mask button. Also: the opacity slider only affects the preview, not the saved mask, so don't panic when a 50%-opacity brush comes out fully opaque in the final file. And file_path only resolves subfolders inside the input folder - if you have two same-named images in different subfolders, it can hand back the wrong path.

    One honest limitation: the editor is not built for giant canvases. On a 3200×5500 image you're waiting maybe twenty seconds for it to load; at 13000×23000 people report it never finishes. The workaround is to resize down, paint, then scale the mask back up - exactly what the Grow/Blur helper in this pack pairs well with.

    CategoryAK/RGBYP

    Inputs (2)

    NameTypeDefaultDescription
    imageCOMBO1 options: example.png
    updaterFLOAT0.75000.0001–1

    Outputs (5)

    NameTypeDescription
    imageIMAGE
    rgbyp_maskIMAGE
    maskMASK
    file_pathSTRING
    file_nameSTRING